如何在plotmatrix中调整图形设置?

时间:2012-07-30 15:15:45

标签: r ggplot2

我可以在plotmatrix中调整点大小,alpha,字体和轴刻度吗?

以下是一个例子:

library(ggplot2)
plotmatrix(iris)

enter image description here

我怎么能:

  • 使分数增加两倍
  • 设置alpha = 0.5
  • 每个轴上的刻度不超过5个
  • 将字体设置为1/2尺寸?

我摆弄了mapping = aes()的{​​{1}}参数以及plotmatrix并添加了诸如opts()之类的图层,但这些图片似乎都没有做任何事情。通过写入大型pdf(+ geom_point(alpha = 0.5, size = 14)),我已经破解了一些修复大小,但这只提供了有限的控制。

1 个答案:

答案 0 :(得分:2)

几乎所有 ggplot2 散点图矩阵选项仍然相当新,可能有点实验性。

GGally 中的设施允许您手动构建此类图表:

custom_iris <- ggpairs(iris,upper = "blank",lower = "blank",
                       title = "Custom Example")

p1 <- ggplot(iris,aes(x = Sepal.Length,y = Sepal.Width)) + 
          geom_point(size = 1,alpha = 0.3)
p2 <- ggplot(iris,aes(x = Sepal.Width,y = Sepal.Length)) + 
          geom_point()

custom_iris <- putPlot(custom_iris,p1,2,1)
custom_iris <- putPlot(custom_iris,p2,3,2)

custom_iris

enter image description here

我只是直接关注?ggpairs中的最后一个例子。