首页 > 解决方案 > 如何在 R Shiny 中操作绘图的交互式工具栏框?

问题描述

如何操作由闪亮包生成的绘图的工具栏(我不确定名称是否正确?!请参阅.)?那是我的代码:图片plotlyserver

 plot_ly(pl.d, x = ~x, y = ~y1, type = 'bar', name = colnames(dataset())[2], marker = list(color = "#26478A"),
            height=800) %>%
      add_trace(y = ~y2, name = colnames(dataset())[3], marker = list(color = "#FF6600")) %>%
      add_trace(y = ~y3, name = colnames(dataset())[4], marker = list(color = "#7E182F")) %>%
      layout("title" = colnames(d.plot)[1],
             xaxis = list(title = "", tickangle = 65,tickfont  = list(family= "Arial",size = 14),
                          margin = m
                          ), 
             yaxis = list(title = "",ticksuffix = "%"),
             barmode = 'group'
            # autosize = F, width = 500, height = 500,,margin = m
             ) 

标签: rshinyr-plotly

解决方案


不确定你想在工具栏中修改什么,但如果你想拿走一些项目,你可以使用config(modeBarButtonsToRemove = list("lasso2d","hoverClosestCartesian", "hoverCompareCartesian","select2d"))至少对于 ggplotly 是这种情况,但我很确定你也可以将它与 plotly 函数一起使用。


推荐阅读