我有这个图表。
g <- retention_cohorts %>%
ggplot(aes(relative_week, round(percent,2), label=relative_week)) +
geom_line() +
scale_y_continuous(labels = percent) +
scale_x_continuous(breaks = seq(1,24,4),
labels = seq(1,6)
) +
geom_text(nudge_y = .02) +
labs(
title = "Purchasing Retention Analysis",
subtitle = "Customers who order at least one item each week",
y = "Customers with at least One Purchase",
x = "Relative Month"
) + theme_light()
Run Code Online (Sandbox Code Playgroud)
这是一个很棒的图表,我想让它具有交互性。当我使用 时ggplotly(g),它几乎完美地重新创建了它,只是它删除了副标题。有没有办法强制它保留副标题或plotly在创建实体后添加新文本作为副标题?
我想编辑情节的标题,以便它有四个单词,最后一个单词为粗体,例如:标题:“这是”(普通字体)“我的情节”(粗体)。
我已经尝试了一些在网上找到的代码,但是我只设法使该图的所有标题都加粗。我的代码(示例)看起来像这样,因为我也想更改标题的颜色和位置。现在,由于我的代码中的“ face = bold”,所有标题均以粗体显示。如上所述,我只希望最后两个单词以粗体显示,但在一行中,因此下面没有字幕或另一行。我正在使用ggplot2,将不胜感激!
plot4 <- plot4 + labs(title = "This is my plot")
plot4 <- plot4 + theme(plot.title=element_text(hjust=0.5, vjust=0.1, face='bold', colour="blue"))
Run Code Online (Sandbox Code Playgroud)