r - Change label in ggpairs upper panel -
do know how change labels in upper panel in ggpairs
(ggally
package)? found how change size, font not label. here want shorten label ("set" pour setosa etc...). tried put in labels=c("set", "ver", "vir")
or upper=list(params=list(size=8),labels=c("set", "ver", "vir"))
doesn't work.
ggpairs(iris, columns=c(2:4), title="variable analysis", colour="species", lower=list(params=list(size=2)), upper=list(params=list(size=8)))
conceptually same @mike's solution, in 1 line.
levels(iris$species) <- c("set", "ver", "vir") ggplairs(<...>)
here's another, more flexible proposal if have many levels , not want abbreviate them hand: trim levels desired length.
levels(iris$species) <- strtrim(levels(iris$species), 3) ggplairs(<...>)
and way, width
parameter vectorized:
rm(iris) strtrim(levels(iris$species), c(1, 3, 5)) #[1] "s" "ver" "virgi"
Comments
Post a Comment