cs0815
cs0815

Reputation: 17388

rotate labels of mosaicplot

Would anyone happen to know how to rotate the labels in a mosaicplot - see for example this code:

employee <- read.csv("Products.csv", TRUE, sep = ",",
                     na.strings = TRUE)

count <- table(employee$EnglishCountryRegionName, 
               employee$Color)
count
mosaicplot(count)

taken from here. Using ggplot I would usually use:

theme(axis.text.x  = element_text(angle=45, vjust=0.5))

Upvotes: 0

Views: 1434

Answers (1)

RLave
RLave

Reputation: 8364

You can play with las parameter, but it has only 4 options (see help("par")):

count <- table(mtcars$cyl, 
               mtcars$gear)
dimnames(count)[[1]] <- c("aaa", "bbb", "ccc")
dimnames(count)[[2]] <- c("ddd", "eee", "fff")
count
#     ddd eee fff
# aaa   1   8   2
# bbb   2   4   1
# ccc  12   0   2

mosaicplot(count, las=2)

Upvotes: 1

Related Questions