Reputation: 33
I'm trying to change the default settings on displaying the x values at the top of the plot to the bottom of the plot.
Here is a small example:
Betta <- c(1,12,23,20)
dim(Betta) <- c(2,2)
dimnames(Betta) <- list(Temperature = c("28", "25"), Flare = c("Yes", "No"))
mosaicplot(x = Betta, main = "Title")
To make things clear, I'm trying to move the temperature values 28 and 25 to the bottom on the graph, right above x axis "Temperature".
Appreciate the help!
Upvotes: 3
Views: 1472
Reputation: 5314
You can use package ggmosaic
with the example below
df <- as.data.frame(as.table(Betta)) # first, transform the contingency table into a data.frame
library(ggmosaic)
ggplot(data=df)+
geom_mosaic(aes(weight=Freq,x=product(Temperature), fill=Flare))+
labs(x="Temperature")
Upvotes: 2