With an ordinary plot, to customise the axis it is possible to suppress drawing the axis and then call Axis. I have been trying to change the location of the y-axis on a plot.table plot to the right hand side, but cannot even work out how to suppress drawing the labels. Here is a toy example of the sort of plot I am working with. Any suggestions as to how to have the axis on the right hand side not the left hand side would be appreciated. set.seed(2) data <- data.frame(x= floor(runif(80)*5)+1, y=floor(runif(80)*5)+1) data$a <- c("Cow", "Dog", "Fish", "Mouse", "Frog")[data$x] data$b <- c("Banana", "Apple", "Pear", "Orange", "Melon")[data$y] plot(table(data$a, data$b), col=rainbow(5), las=1, main="") Regards, Sean. -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody [[alternative HTML version deleted]]
Sean Carmody wrote:> > With an ordinary plot, to customise the axis it is possible to suppress > drawing the axis and then call Axis. I have been trying to change the > location of the y-axis on a plot.table plot to the right hand side, but > cannot even work out how to suppress drawing the labels. > >Thanks for the nice example. "plot" calls mosaicplot, and looking at the code it seems that the labels are rather hard-wired. Even dirty tricks like setting the margins do not help, and data$a <- c("", "", "", "", "")[data$x] neither. So I would recommend to use package vcd instead, which has very detailed detail handling. Dieter -- View this message in context: http://www.nabble.com/Draw-plot.table-axis-on-right-hand-side-tp24689766p24693737.html Sent from the R help mailing list archive at Nabble.com.
Dieter Menne wrote:> > With an ordinary plot, to customise the axis it is possible to suppress > > drawing the axis and then call Axis. I have been trying to change the > > location of the y-axis on a plot.table plot to the right hand side, but > > cannot even work out how to suppress drawing the labels. > > > > > > Thanks for the nice example. "plot" calls mosaicplot, and looking at the > code it seems that the labels are rather hard-wired. Even dirty trickslike> setting the margins do not help, and > > data$a <- c("", "", "", "", "")[data$x] > > neither. > > So I would recommend to use package vcd instead, which has very detailed > detail handling. > > DieterThanks Dieter. I see vcd had a detailed vignette. That should help me get to grips with mosaic, which does appear to be extremely flexible. -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody [[alternative HTML version deleted]]