[R] a way to control xlim in multhist?

From: Justin Gengler <jgengler_at_umich.edu>
Date: Thu 11 Jan 2007 - 23:59:03 GMT

Thanks in advance for any suggestions:

I am using the 'multhist' function in the 'plotrix' package to display histograms of some variable 'x' given some value of another variable 'z' -- for example, separate histograms for some variable according to sex (or another dichotomous) variable. Thus I am using something like the following:


This generates histograms well enough, but because one cannot control the 'xlim' parameter the x-axis labels are very odd (or rather, strictly speaking, you CAN control it, but doing so does not change the x-axis value labels in the same way that it would if you were using the simple 'hist' command). More specifically, the labels almost always seem to progress in increments of 5 or 0.5, depending on the scale (see, for example, this graph: http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=82). Moreover, if x is, say, a categorical variable with possible values of 1 through 5, the x-axis labels will remain in the base-5 form (e.g., 0.5, 1.5, 2.5, etc.) rather than taking on the various categorical values, regardless of any xlim specification.

I realize that the issue here is that multhist relies on the 'barplot' function, so I have attempted to hack the xlim change there. But no dice.

So the bottom line is: is there a way to control x-axis scale and labeling through xliim when using multhist?


Justin Gengler

Also: for a concrete demonstration of what I mean, compare the following:


mh <- list(rnorm(200, mean=100, sd=10), rnorm(200, mean=100, sd=10)) multhist(mh)



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri Jan 12 19:32:24 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 12 Jan 2007 - 09:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.