为什么在我闪亮的应用程序中ggplotly切断了图例?

时间:2019-01-22 13:40:54

标签: r ggplot2 shiny plotly

我的flexdahboard中有两个页面,它们都使用闪亮的页面,有时ledgend被切断,有时则不然。我不知道为什么。它也没有使用整页。有办法解决这个问题吗?

Here is the Plot

我尝试弄乱Figsize,但是它没有用,我认为ggplotly应该具有自己的大小?

---
title: "Margin Analysis"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    theme: cosmo
runtime: shiny
---


shinyApp(
ui <- fluidPage(sidebarLayout(
sidebarPanel(
  selectInput("Group_By",
                 label = "Group By",
                 choices = c("ProductClass",  "ItemClassDesc"),
                 selected = 'ProductClass'),
  selectizeInput("Product_Class",
                 label = "Product Class",
                 choices = unique(reg_by_prod$ProductClass),
                 selected = unique(reg_by_prod$ProductClass)[1]),
  selectizeInput("Item_Class",
                 label = "Item Class",
                 choices = unique(reg_by_prod$ItemClassDesc),
                 selected = unique(reg_by_prod$ItemClassDesc)[1]),
  width = 2
),

mainPanel(
  plotlyOutput('graph'),
  dataTableOutput('table')

))),


server <- function(input, output, session){



 ggplotly(ggplot(fiscal_tidy_var, aes(as.numeric(month), Value, color = Delta))+
             geom_point(size = 2)+
             geom_line(size = 1.25, alpha = .75) +
             scale_x_continuous(breaks = 1:12, labels = c('Oct', 'Nov', 'Dec',
                                                          'Jan', 'Feb', 'Mar',
                                                          'Apr', 'May', 'Jun',
                                                          'Jul', 'Aug', 'Sep'))+
             xlab('Month') +
             ylab('Percent Delta') +
             geom_ribbon(aes(ymax = 0, ymin = min(Value)),
                         fill="red",colour=NA,alpha=0.1) +
             geom_ribbon(aes(ymax = max(Value), ymin = 0),
                         fill="green",colour=NA,alpha=0.1) +
             theme_minimal() +
             ggtitle(input$Item_Class))

0 个答案:

没有答案