Github问题似乎还没有完全解决...因此,对于其他急需在ggplot中使用马赛克图的人,如果无法使github更新正常工作,则可以使用annotate:
data(Titanic)
titanic <- as.data.frame(Titanic)
titanic$Survived <- factor(titanic$Survived,
levels = c("Yes", "No"))
ggplot(data = titanic) +
geom_mosaic(aes(weight = Freq, x = product(Class), fill = Survived)) +
labs(x = "Passenger class",
y = "Survived sinking",
title = "Survival rate by passenger class")+
annotate(geom="text",x=0.43,y=-0.02,label="This is a very silly solution",
color="black",size=3) +
annotate(geom="text",x=-0.02,y=0.5,label="0 0.25 0.5 0.75 1",
colour="black",size=3,angle=90)
mosaic
的例子吗?(参见:https://dev59.com/eG025IYBdhLWcg3whGSx) - dc37