首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当使用ggplotly()显示Plot时,plot字幕丢失

当使用ggplotly()显示Plot时,plot字幕丢失
EN

Stack Overflow用户
提问于 2021-09-06 11:17:34
回答 1查看 32关注 0票数 0

我在下面创建了带有标题和副标题的ggplot,但是当我使用ggplotly()显示它时,副标题就丢失了。

代码语言:javascript
复制
library(ggplot2)
p <- ggplot(ToothGrowth, aes(x = factor(dose), y = len)) + 
  geom_boxplot()
library(plotly)
p <- p + labs(title = "Effect of Vitamin C on Tooth Growth",
              subtitle = "Plot of length by dose",
              caption = "Data source: ToothGrowth")
ggplotly(p)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-06 11:22:28

代码语言:javascript
复制
library(ggplot2)
p <- ggplot(ToothGrowth, aes(x = factor(dose), y = len)) + 
  geom_boxplot()
library(plotly)
p <- p + labs(title = "Effect of Vitamin C on Tooth Growth",
              subtitle = "Plot of length by dose",
              caption = "Data source: ToothGrowth")
ggplotly(p)%>% 
  layout(title = list(text = paste0('Effect of Vitamin C on Tooth Growth"',
                                    '<br>',
                                    '<sup>',
                                    'Plot of length by dose','</sup>')))

如果它解决了你的问题,请让我知道

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69073658

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档