r - 悬停时使用透明模式栏背景进行绘图
问题描述
基于这个问题,我还想在将鼠标悬停在模式栏上时更改其背景颜色。我查看了 css,但找不到或更改相关部分。
这是一个要测试的小shinyApp:
library(shiny)
library(plotly)
ui <- fluidPage(
plotlyOutput("plotly")
)
server <- function(input, output, session) {
output$plotly <- renderPlotly({
plot_ly(data = mtcars) %>%
add_markers(x=~mpg, y=~disp) %>%
layout(plot_bgcolor='transparent', paper_bgcolor='transparent')
})
}
shinyApp(ui, server)
解决方案
我让它透明,但选项也是不可见的,所以我添加了颜色和活动颜色,请参见此处。如有必要,请随意更改。
library(shiny)
library(plotly)
ui <- fluidPage(
plotlyOutput("plotly")
)
server <- function(input, output, session) {
output$plotly <- renderPlotly({
plot_ly(data = mtcars) %>%
add_markers(x=~mpg, y=~disp) %>%
layout(plot_bgcolor='transparent', paper_bgcolor='transparent',
modebar=list(bgcolor='transparent', color='blue', activecolor='green'))
})
}
shinyApp(ui, server)
推荐阅读
- r - 函数内部的意外赋值
- orientdb - 如何在 gremlin 地图上按计数过滤(OrientDB)
- entity-framework - Linq Join on Lists 生成重复数据列表
- c# - 在不使用树视图控制器的情况下创建树视图
- python - Numpy:根据布尔数组选择元素
- python - 如何从字符串中选择某些数字
- excel - 在字符串中包含一个单词并记录以下字符串
- c# - 如何修复 DeleteManyAsync 返回使用过滤器删除的 0 条记录?
- treeview - Vaadin 10 TreeGrid.refreshItem 仅在鼠标单击后刷新
- python - 当列表 1 中有匹配项时,如何检查两个不等长子列表的相似性并添加到列表 2 的分数?