斜体ggplotly图中的标题
Italicize the caption in ggplotly figure
我不确定为什么标题没有改变,我可能使用了错误的功能。这是一个例子:
我的数据框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"))
)
谢谢!
我不确定为什么标题没有改变,我可能使用了错误的功能。这是一个例子:
我的数据框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"))
)
谢谢!