[R] Help with Boxplot

Clint Bowman clint at ecy.wa.gov
Thu Mar 5 19:26:24 CET 2015


Jim,

Have you looked at:

names: group labels which will be printed under each boxplot.  Can
           be a character vector or an expression (see plotmath).

You could use "" where you want a blank.  I believe that "at" may work 
here also.

Clint

Clint Bowman			INTERNET:	clint at ecy.wa.gov
Air Quality Modeler		INTERNET:	clint at math.utah.edu
Department of Ecology		VOICE:		(360) 407-6815
PO Box 47600			FAX:		(360) 407-7534
Olympia, WA 98504-7600

         USPS:           PO Box 47600, Olympia, WA 98504-7600
         Parcels:        300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 5 Mar 2015, Jim Silverton wrote:

> I have the following R code for a boxplot. But I keep getting 4 1's, 4 2's
> and 4 3's on the x asis for which I reall want to relace the 1's by
> agegroup 1 the 2's by age group 2 etc. And I don't want to replce it 4
> times just once. Can anyone help.
>
>
> boxplot(data.all ~ age.group, data = data.plots,
>        boxwex = 0.5, at = c(1, 4, 7, 10),
>        subset = model.type == 1, col = "yellow",
>        main = "Deviation of Predicted from Actual",
>        xlab = "Age Groups",
>        ylab = "Deviations",
>        xlim = c(0.5, 12), ylim = c(-25, 35))
> boxplot(data.all ~ age.group, data = data.plots, add = TRUE,
>        boxwex = 0.5, at = c(1.7, 4.7, 7.7, 10.7),
>        subset = model.type == 2, col = "orange")
> boxplot(data.all ~ age.group, data = data.plots, add = TRUE,
>        boxwex = 0.5, at = c(2.4, 5.4, 8.4, 11.4),
>        subset = model.type == 3, col = "blue")
> legend(1, 30, c("regression", "glm", "gam"),fill = c("yellow", "orange",
> "blue"))
>
>
>
> -- 
> Thanks,
> Jim.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>



More information about the R-help mailing list