From: Charilaos Skiadas <skiadas_at_hanover.edu>

Date: Sun 14 Jan 2007 - 04:12:00 GMT

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 Sun Jan 14 15:17:00 2007

Date: Sun 14 Jan 2007 - 04:12:00 GMT

Greetings,

I am trying to add a boxplot to the bottom of a histogram, right between the histogram bars and the x axis. Here is the code I am using at the moment (the par line is probably not relevant for our discussion):

hs <- hist(x, breaks = 20, plot = F)

par(mar = c(3,3,2,1))

hist(x, breaks = 20, main = NULL, ylim = c(-2, max(hs$counts)))
boxplot(x, horizontal = T, axes = T, add = T, at = -1)

The problem is the following. As it is, the boxplot restricts itself to the -1 line. I would like it to occupy both the -1 and the -2 lines ( I guess more generally I would like to control how much vertical space the "embedded boxplot" occupies). I tried to set the width parameter in the boxplot, but that seemed to have no effect at all.

On an OT note, I haven't seen this way of combining a histogram with a boxplot (perhaps I haven't looked really hard). I thought it would be useful for my students to see them next to each other, to develop a feeling for what histograms might correspond to what boxplots. Is there perhaps some reason why I should avoid showing those graphs to them like that, that I am not aware of? Or just a reason why I haven't seen them combined like this much?

**TIA
**
Charilaos Skiadas

Department of Mathematics

Hanover College

P.O.Box 108

Hanover, IN 47243

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 Sun Jan 14 15:17:00 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 Mon 15 Jan 2007 - 13:30:32 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.
*