开发者

ggplot2 plotmatrix - changing text labels

开发者 https://www.devze.com 2023-01-17 22:57 出处:网络
I\'m using the plotmatrix function in ggplot2 (ggplot2_0.8.8) and would like to override the column names dis开发者_Go百科played from my dataframe, e.g.

I'm using the plotmatrix function in ggplot2 (ggplot2_0.8.8) and would like to override the column names dis开发者_Go百科played from my dataframe, e.g.

plotmatrix(mtcars) + opts(strip.text.x = theme_text(size=20))

I can alter the properties of strip.text.x and strip.text.y with opts, but where can I change the text itself e.g. I would like "mpg" replaced by "Miles / Gallon" which causes problems as a colname. I assume there may be something like the labeller option in facet_grid which allows me to substitute arbitrary text for the existing colnames?


Rename the columns.

x <- mtcars ## just because I like x.
colnames(x)[1] <- "Miles/Gallon" ## rename all by dropping [1] and using c(...)
plotmatrix(x) + opts(strip.text.x = theme_text(size=20))
0

精彩评论

暂无评论...
验证码 换一张
取 消