[英]Remove double legend plotly in R
I don't know why I have a double legend.我不知道为什么我有一个双重传奇。 How to remove the second legend where it is written "Aa"如何删除写有“Aa”的第二个图例
Code:代码:
city = c("paris", "lyon", "lyon", "marseille", "lille", "toulouse", "bordeaux")
start = c("2018-08-04", "2018-07-25", "2018-07-30", "2018-07-29", "2018-08-03", "2018-08-04", "2018-08-03")
max = c(36.4, 37.2, 38.4, 37.4, 36.7, 34.9, 34.8)
duration = c(4, 3, 8, 10, 5, 4, 3)
tab = as.data.frame(city, start, duration, max)
tab$duration = as.integer(tab$duration)
t <- list(
family = "sans serif",
size = 14,
color = toRGB("grey50"))
bubbleplot <- plot_ly(tab, x = ~start, y = ~max,
text = ~paste(duration, "jours"),
color = ~city, mode='markers+text'
)
bubbleplot = bubbleplot %>% add_markers(
marker = list(size = ~duration*4, opacity = 0.7,
sizemode = "diameter"))
bubbleplot <- bubbleplot %>% add_text(textfont = t, textposition = "inside")
bubbleplot
Use the following,使用以下,
t <- list(
family = "sans serif",
size = 14,
color = toRGB("grey50"))
bubbleplot <- plot_ly(tab, x = ~start, y = ~max,
text = ~paste(duration, "jours"),
color = ~city, mode='markers+text'
)
bubbleplot = bubbleplot %>% add_markers(
marker = list(size = ~duration*4, opacity = 0.7,
sizemode = "diameter")) %>% add_text(x = ~start, y = ~max,
text = ~paste(duration, "jours"), textfont = t, textposition = "inside", data = tab, inherit = F)
bubbleplot
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.