[R] Struggling trying to plot points on boxplot

William Dunlap wdunlap at tibco.com
Thu Jun 2 17:52:10 CEST 2016


Does using zz<-bxp(boxplot(data,plot=FALSE)) do what you want?  E.g.,

d <- transform(data.frame(t=1:15), x = sin(t)+log2(t), group =
paste("Group", t%/%4))
groupedX <- with(d, split(x, group))
zz <- bxp(boxplot(groupedX, plot=FALSE)) # bxp returns the x positions of
the boxes
points(col="blue", pch=15, zz, vapply(splitX, FUN=mean, FUN.VALUE=0))


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Jun 2, 2016 at 8:36 AM, Thomas Adams <tea3rd at gmail.com> wrote:

> Hello all:
>
> I've been beating my head on this for over a day and I have done a lot of
> Google'ing with no luck.
>
> I have generated a 'time-series' of boxplots (227), covering more than a
> 30-day period at 6-hour intervals, which summarize an ensemble forecast.
> What I want to do is over-plot the observed values over a portion of the
> forecast period to serve as a basis of comparison; so, there would be a
> boxplot and a single point value plotted at each 6-hour interval.
>
> The boxplots are generated:
>
> zz<-boxplot(ens$value ~ ens$valid_time,xlab="Date/Time
> (UTC)",ylab="Flow(cfs)",boxfill="cyan")
>
> which works fine, but the observed points will not display using:
>
> points(zz, obs$value,lty=3,lwd=1,col="red",pch=19)
>
> I've tried many variations of the latter, where either nothing happens and
> no error is returned or I have also gotten that x and y have different
> lengths. I suspect I am using the wrong 'x' type. I have observation values
> beginning with the first in the series of boxplots, which then end, with
> the most recent ensemble forecast. So, I always expect the number of
> observed values to be less than the number of boxplots. I have done this
> previously, years ago, but can not find my notes and can not reconstruct
> what I did.
>
> Help is appreciated.
>
> Regards,
> Tom
>
>         [[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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list