R Plotly下拉菜单的更改方向

时间:2019-01-23 22:09:43

标签: r drop-down-menu plotly r-plotly

我们怎样才能在R中绘制下拉菜单的方向?示例代码https://gist.github.com/AliciaSchep/beca4cd1145b8caf7c8136e5979039b4

Python的密谋有一个direction = 'up'。我还检查了输出的内容。似乎找不到它。

library(plotly)
plot_ly(mtcars, x = ~wt) %>%
    add_markers(y = ~mpg, name = "mpg") %>%
    add_markers(y = ~hp, name = "hp", visible = FALSE) %>%
    layout(
        title = "Drop down menus - Update",
        xaxis = list(domain = c(0.1, 1)),
        yaxis = list(title = "mpg"),
        showlegend = FALSE,
        updatemenus = list(
            list(
                y = 0.7,
                buttons = list(
                    list(method = "update",
                         args = list(list(visible = list(TRUE, FALSE)),
                                     list(yaxis = list(title = "mpg"))),
                         label = "mpg"),

                    list(method = "update",
                         args = list(list(visible =  list(FALSE, TRUE)),
                                     list(yaxis = list(title = "hp"))),
                         label = "hp")))
        )
    )

0 个答案:

没有答案