ggplotly() doesn't support multiple colors in axis ticks
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello and thanks for the great job you did by making this really useful package. I just want to report an issue that appears when I need to colour the axis text of a plot with pre - defined colours. Below you can see the R code to build a really simple shiny app. If I plot my graph with the standard ggplot() function the names of the x axis result colored, but if I use the function ggplotly() to make my plot interactive, the text of the x axis remains black (the functions recognizes the arguments "angle" and "hjust" but not "col").
Thanks in advance for the availability.
Nico
library(ggplot2)
library(plotly)
library(shiny)
### UI
ui <- fluidPage(
fluidRow(
column(width = 8,
plotlyOutput(outputId = "plot",
height = "600px"))))
### SERVER
server <- function(input, output) {
output$plot <- renderPlotly({
mpg_s <- mpg[c(1, 19, 38), ] # subset to pick just 3 rows
col <- c("red", "green", "blue")
p <- ggplot(data = mpg_s,
aes(x = manufacturer, y = hwy)) +
geom_point() +
theme(axis.text.x = element_text(size = 20,
angle = 90,
hjust = 1,
colour = col))
ggplotly(p)
})
}
### LUNCH APP
shinyApp(ui = ui, server = server)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 提供了一个在 Shiny 应用中可复现的 ggplotly(p) 示例,但没有指明 repository 文件或测试。首先跟踪 ggplotly 如何转换 ggplot2 的 axis.text.x 设置,然后比较 ggplot 输出和交互式输出;当预定义颜色出现在交互式 x 轴刻度标签上时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100