Hello All, 

 

I'm trying to right-justify the y-axis labels in a mosaic plot from base
R. I've tried too many commands (adj specifically) to list here and
nothing works so far. I'm sure this could be done in the vcd or ggplot2
packages, but I would prefer to do it with mosaicplot in base R if at
all possible and I suspect it is possible. Illustration code is below-
I'm trying to make "q", "qwe", and "qwertyqwerty" right-justified
instead of left. The prop.table and order bits are unnecessary for the
sample but I need them for my actual analyses so I included them here in
case that somehow affects the code needed. I would be incredibly
appreciative of any help!

 

#demo

a<-c("qwertyqwerty", "qwertyqwerty", "qwertyqwerty", "qwe", "qwe",
"qwe", "q", "q", "q")

b<-c(1, 2, 3, 1, 1, 3, 2, 2, 3)

demo<-data.frame(a, b)

y<-table(demo)

y<-as.table(y[order(rowSums(y)),])

y<-prop.table(y)

plot(y, 

dir=c("h", "v"),

las=1)

 

Ryan Derickson

VHA NCOD

513-247-4294

 


	[[alternative HTML version deleted]]

