Re: [R] Controlling size of boxplot when it is added in a plot

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Mon 15 Jan 2007 - 13:08:51 GMT

>>>>> "Charilaos" == Charilaos Skiadas <skiadas@hanover.edu>
>>>>> on Sat, 13 Jan 2007 23:12:00 -0500 writes:

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

Charilaos> hs <- hist(x, breaks = 20, plot = F)
Charilaos> par(mar = c(3,3,2,1))
```

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

Charilaos> The problem is the following.

```    Charilaos> ........................

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

The 'sfsmisc' package (on CRAN) has been containing a function called hist.bxp() which does these plots, for a very long time --- actually for almost a longer time than R exists. It was part of our internal collection of S-plus "goodies" since 1995.

Martin Maechler, ETH Zurich

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 Tue Jan 16 00:12:15 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 - 14:00: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.