有人会碰巧知道如何在马赛克图中旋转标签 - 例如,请参阅此代码:
employee <- read.csv("Products.csv", TRUE, sep = ",",
na.strings = TRUE)
count <- table(employee$EnglishCountryRegionName,
employee$Color)
count
mosaicplot(count)
取自here。使用ggplot我通常会使用:
theme(axis.text.x = element_text(angle=45, vjust=0.5))
您可以使用las
参数,但它只有4个选项(请参阅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)