[R] controlling the x axis of boxplots

Chris Evans chris at psyctc.org
Tue Apr 19 22:51:57 CEST 2005


v 2.0.1 (sooooh old!) on Win2k

I think I know the answer to this but I can hope ...

I have data for continuous variables (measures of residents) by a 
categorical variable in range (1,22), the units in which they live.  

I want to plot these data with a pair of boxplots one above another 
with same x-axis (1,22) using par(mfrow=c(2,1)) and then plotting 
first for the women then for the men.  My problem is that some units 
have only men, some have only women, and some have both.  I'd like 
both plots to have the same x axis and the notched, varwidth boxplots 
to locate themselves with some gaps so that the units are in the same 
place on the x axis on each plot.

I think that I can't do this with boxplot or bxp as both work out the 
x axis from the work that boxplot has done on the data.  Although 
there also seem to be useful extensions or alternative boxplots in 
other packages, I can't see one that does what I want and I think 
that rolling my own from bxp is really beyond my skills.

Am I right that it doesn't exist in the CRAN packages?  If not, 
apologies and point me where I should look?  If I am right (boo hoo!) 
I don't suppose anyone has written this or is feeling like 
demonstrating their personal genius with R coding?!!!  If they were, 
I don't think I'd be the only one to end up owing them a great deal 
of gratitude!

Thanks as ever to all who have made and continue to make R what it 
is: brilliant!

Chris


-- 
Chris Evans <chris at psyctc.org>
Consultant Psychiatrist in Psychotherapy, Rampton Hospital; 
Research Programmes Director, Nottinghamshire NHS Trust, 
Hon. SL Institute of Psychiatry
*** My views are my own and not representative of those institutions 
***




More information about the R-help mailing list