![](/img/trans.png)
[英]Is there a way to make a 2D circular density plot of intensity from x, y, z values; that looks like the stat_density2d plot?
[英]Greek Letters for stat density 2d plot
考慮以下情節:
# fake data
set.seed(1234)
n <- 200
gg <- data.frame(wf=rnorm(n,0.5),wb=rnorm(n,0.5),z=runif(n,0,6))
# plot it
gg$`My Title` <- gg$z
ggplot(data=gg, aes(x=wf, y=wb, color=`My Title`)) +
geom_point(aes(colour=z),shape="") +
stat_density2d(aes(fill = ..level..),n = 100,contour = TRUE,geom = "polygon") +
labs(x=expression(w[f]),y=expression(w[b])) +
guides(fill=F)
我想將“ My Title
更改為希臘字母或文本與希臘字母的混合體。 謝謝!
添加guides(colour=guide_colorbar(title=expression(paste("This is a greek letter: ", alpha))))
應該可以:
# fake data
set.seed(1234)
n <- 200
gg <- data.frame(wf=rnorm(n,0.5),wb=rnorm(n,0.5),z=runif(n,0,6))
ggplot(data=gg, aes(x=wf, y=wb, color=z)) +
geom_point(aes(colour=z),shape="") +
stat_density2d(aes(fill = ..level..),n = 100,contour = TRUE,geom = "polygon") +
labs(x=expression(w[f]),y=expression(w[b])) + guides(fill=F) +
guides(colour=guide_colorbar(title=expression(paste("This is a greek letter: ", alpha))))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.