English 中文(简体)
图2
原标题:Changing shapes used for scale_shape() in ggplot2
  • 时间:2009-09-25 17:15:01
  •  标签:

附录一如下:

y <- rnorm(10)
b <- as.factor(sample(1:4,10,replace=T))
qplot(1:10, y, shape=b)

我如何改变使用<代码>ggplot2的形式?

最佳回答

这样做的计算方法是使用<条码> 尺度_shape_manual ,并在<条码>价值的辩论中提供所希望的形式:

qplot(1:10, y, shape=b) + scale_shape_manual(values = c(0, 5, 6, 15))

https://imgur.com/UAmPd.png” alt=“result of above”/>

这些形状与通常的0-25指数相同:rel=“noreferer” http://yusung.blogspot.com/2008/11/plot-symbols-in-r.html>。

问题回答

为补充Harlan的回答,此处是现有形状的参考资料——从底部0开始,然后改为右线(10y+x):

df <- data.frame(x=c(0:129))
ggplot(df, aes(x=x%%10, y=floor(x/10), shape=factor(x), colour=x, size=10)) +
  geom_point() +
  scale_shape_manual(values=df$x) + theme(legend.position= none ) +
  scale_x_continuous(breaks=0:10) + scale_y_continuous(breaks=0:12) +
  scale_colour_hue() + scale_colour_gradientn(colours=rainbow(3))

“Shapes

> y <- rnorm(10)
> b <- as.factor(sample(1:4,10,replace=T))
> qplot(1:10, y, shape=b)
> qplot(1:10, y, pch=letters[1:10], cex=6)

你们指的是什么? 我想象你们会利用R的阴谋特性......

这可能不是这样做的非常细微的方法,但男子的网页是“你可以像你那样使用地块功能”。

https://imgur.com/N2YDt.png” alt=“alt text”/>





相关问题
热门标签