在闪亮的 mainPanel 和 sideerbarPanel 之间添加 space

Add space between mainPanel and sideerbarPanel in shiny

在下面这个闪亮的应用程序中,我想在底部的 mainPanel 和 siderbarPanel 之间添加一些空格。

在这里,我无法读取 x 轴刻度,我尝试旋转它们,但没有改善问题。 我还更改了 plotlyOutput 的高度和宽度,但不起作用。 我尝试添加一个 HTML("<br><br><br>") 但也不起作用,问题可能来自 ggplot 或 plotly ?

我的 ggplot 脚本是:

  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不支持水平图例,所以下图是正常的。

谢谢

这篇 Plotly Setting Graph Size in R 文章可能会有帮助。由于您没有包含所有代码,因此我无法完全确认。请告诉我。

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
    )
  )