r - 斜体ggplotly图中的标题
问题描述
我不确定为什么标题没有改变,我可能使用了错误的功能。这是一个例子:
我的数据框moment.curve
:
moment.curv <- structure(list(row = 1:5, Curvature = c(
0, 0.001805, 0.004512,
0.008121, 0.0126
), Moment = c(
0, 192.0442, 242.8942, 256.6455,
258.1099
)), class = "data.frame", row.names = c(NA, -5L))
我使用以下代码来创建绘图:
plot.moment.curv <- ggplot(moment.curv) +
aes(x = Curvature, y = Moment) +
geom_line(size = 1L, colour = "#0c4c8a") +
labs(x = "bla", y = "bla") + theme_classic()
我使用以下内容创建一个 ggplotly 交互式绘图,请记住,我想保留这种格式,即在 ggplot 中制作原始绘图,然后使用 ggplotly 将其转换为交互式绘图。我创建的实际数字要复杂得多,这使过程更容易。
ggplotly(
p = ggplot2::last_plot(),
width = NULL,
height = NULL,
tooltip = "all",
dynamicTicks = FALSE,
layerData = 1,
originalData = TRUE,
) %>%
layout(margin = list(b=130,t=100), annotations =
list(x = 1, y = -0.4, text = "THE CAPTION",
showarrow = F, xref='paper', yref='paper',
xanchor='right', yanchor='auto', xshift=0, yshift=0,
font=list(size=15,fontfacet="italic"))
)
谢谢!
解决方案
推荐阅读
- javascript - 为什么这个 JavaScript 小书签会清除页面?
- firebird - 在firebird中的表格中插入多行
- javascript - 从 NodeList 中获取元素的索引
- json - 快速重新加载新的 JSON 数据
- javascript - element.getBoundingClientRect 不断返回初始值
- groovy - Groovy:我如何 grep 字符串
- android - 无论如何,有没有通过 Appium 为 IOS 和 android 自动扫描二维码?
- angular - 如何使用带有两个 html 的 routerLink
- r - 如何循环一列,如果模式匹配,使用 R 计算其他列中的相关字符?
- javascript - Google Scripts 中的简单计数功能