How do you change the order of explanatory and response variables in a mosaic plot?

38 views Asked by At

My work.
What I want.
How can I modify my R code so that my explanatory variables (Captured, Not Captured) are on the bottom part of my plot, the response variables (Captured, Not Captured) on the right side of my plot? My teacher is not accepting my mosaic plot, because: (1) my x- and y-axis extrude (2) the explanatory variables should be on the bottom (3) the response variables should be on the right. I really hope someone can help me out.. I've been trying on YT but I can't find anything. I attached my R code below.

Thanks in advance!

mosaictable <- matrix (c (3, 9, 22, 21), byrow = T, ncol = 2)
rownames (mosaictable) = c ("White", "Blue ")
colnames (mosaictable) = c ("Captured", "Not Captured")
mosaicplot  ((mosaictable), sub = "Pigeon Color", ylab = "Relative frequency", 
            col = c ("firebrick", "goldenrod1"), font = 2, main = "Mosaic Plot of Pigeon Color and Their Capture Rate"
            
            )
axis (1)
axis (4)
0

There are 0 answers