r - How to disable y-axis in mosaic plot? -
how disable y-axis in mosaic plot?
example:
x <- data.frame(o=c(rep("aaaaaaaaaaaaaaaaaaa",50),rep("bbbbbbbbbbbbbbbbbbbbbbbbbbbbb",40),rep("cccccccccccccccccccccccccccccccc",70)),r=runif(160)) x$int <- findinterval(x$r, seq(0.1,1,0.1), rightmost.closed = true, all.inside = true) tab.dat <- with(x, table(o, int)) par(mar=c(3, 3, 3, 3)) mosaicplot(tab.dat, col=colorramppalette( c("green3", "yellow", "red"), space="rgb")(9), las=2, dir=c("h","v"))
i use own axis function. how can remove y axis names? yaxt="n"
works, not case.
axis(2, at=seq(0, 1, = 1 / (length(rownames(tab.dat)) - 1)), labels=rownames(tab.dat), cex.axis=2.2, line=1.1, las=1)
there doesn't seem way directly mosaicplot
function there easy alternative.
just turn tab.dat
row names ''
, work fine
tab.dat <- with(x, table(o, int)) #i adding line of code below #just use row.names function set names '' row.names(tab.dat) <- rep('',3) par(mar=c(3, 3, 3, 3)) mosaicplot(tab.dat, col=colorramppalette( c("green3", "yellow", "red"), space="rgb")(9), las=2, dir=c("h","v") )
seems easy hack. maybe why developers didn't include argument in mosaicplot
.
output:
Comments
Post a Comment