【发布时间】:2016-10-24 17:08:08
【问题描述】:
当使用ggplotly 将 ggplot 图形转换为 plotly 图形时,我可以获得一些 HTML,例如在标题中:
library(plotly)
library(ggplot2)
library(scales)
library(mvtnorm)
sims <- rmvnorm(500, mean=c(0,0,0))
dat <- setNames(data.frame(sims), c("x", "y", "z"))
dat$z <- dat$x+dat$y
gg <- ggplot(dat, aes(x=x, y=y, colour=z)) +
geom_point() +
scale_colour_gradient2(limits=c(-2,2), midpoint=0, low=muted("blue"), high=muted("red")) +
ggtitle("<em>hello</em>")
ggplotly(gg)
正如预期的那样,标题<em>hello</em> 以斜体显示。
但是当我想要一个 HTML 希腊字母时,这不起作用:
gg <- ggplot(dat, aes(x=x, y=y, colour=z)) +
geom_point() +
scale_colour_gradient2(limits=c(-2,2), midpoint=0, low=muted("blue"), high=muted("red")) +
ggtitle("Δ")
ggplotly(gg)
如何将&Delta; 渲染为预期的希腊字母?
我正在使用plotly_4.5.2 和ggplot2_2.1.0。
【问题讨论】: