2

In the following shiny app, I want to add some spaces between mainPanel and a siderbarPanel in the bottom. enter image description here

Here, I can't read the x axis ticks, I tried to rotate them but it doesnt improve the thing. I also changed the height and width of the plotlyOutput but doesn't work. I tried to add an HTML("<br><br><br>") but doesnt work too, the problem is probably from ggplot or plotly ?

My ggplot script is :

  ggplot(data = df, aes(x = perimetre_commercial_estime,
                        y = nbr_ligne, 
                        fill = perimetre_commercial_estime)) +
    geom_bar(stat="identity") + theme_light() + 
    theme(axis.text.x=element_text(angle=30,hjust=1,vjust=0.5,size=6),
                                      axis.title.x=element_blank(),
          legend.position="top", legend.direction="horizontal") +
    scale_fill_discrete("") 

plotly doesnt support horizontal legend, so the graphic below is normal.

Thanks

Mostafa90
  • 1,674
  • 1
  • 21
  • 39
  • Possible duplicate of [How to add more Whitespace to the Main Panel in Shiny Dashboard?](http://stackoverflow.com/questions/33266157/how-to-add-more-whitespace-to-the-main-panel-in-shiny-dashboard) – Nickil Maveli May 18 '16 at 12:01
  • not really the same, I tried the different solution but no one work – Mostafa90 May 18 '16 at 12:24

1 Answers1

3

This Plotly Setting Graph Size in R article might be helpful. Since you don't include all code, I cannot confirm entirely. Please let me know.

library(plotly)
library(dplyr)

gp = ggplot(
  data = mtcars %>% add_rownames(),
  aes( x = rowname, y = mpg )
) + geom_point() +
  theme(axis.text.x=element_text(angle=30,hjust=1,vjust=0.5,size=6),
        axis.title.x=element_blank())

ggplotly(gp) %>%
  layout(
    margin = list(
      b=100
    )
  )
timelyportfolio
  • 6,479
  • 30
  • 33