我正在使用 R-plotly 生成散点图,并一直在尝试删除动画帧标题(例如下面示例中的“am:0”)。
我可以删除轴和颜色的图例;如何删除动画帧标题,或者将其设置为某些自定义文本,例如“外国”
library(tidyverse)
library(plotly)
df <- mtcars %>% mutate(cyl = as_factor(cyl))
scatter_plot <- plot_ly(data = df, x = ~wt, y = ~mpg, type = 'scatter', mode = 'markers', color = ~cyl, frame = ~am) %>%
layout(xaxis = list(title = " "), yaxis = list(title = " "), legend=list(title= list(text = " ")))
scatter_plot
我找不到任何有关删除框架标题的信息。
此外,仅当 cyl 为因素时才会删除图例标题。
将此添加到您的代码中:
animation_slider(currentvalue = list(prefix = ""))
library(tidyverse)
library(plotly)
df <- mtcars %>% mutate(cyl = as_factor(cyl))
scatter_plot <- plot_ly(data = df, x = ~wt, y = ~mpg, type = 'scatter', mode = 'markers', color = ~cyl, frame = ~am) %>%
layout(xaxis = list(title = " "),
yaxis = list(title = " "),
legend=list(title= list(text = " "))) %>%
animation_slider(currentvalue = list(prefix = ""))
scatter_plot