[R] Plot and Boxplot in the same graph

Greg Snow Greg.Snow at imail.org
Mon Mar 23 17:57:10 CET 2009


Look at the symbols function or the subplot function in the TeachingDemos package (or my.symbols in TeachingDemos).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of johnhj
> Sent: Sunday, March 22, 2009 5:18 AM
> To: r-help at r-project.org
> Subject: Re: [R] Plot and Boxplot in the same graph
> 
> 
> I tried to do it with:
> 
> > y <- rnorm(100)
> > x <- gl(2,50)
> > boxplot(x,y)
> > points(x,y)
> 
> But the problem is, that the the y coordinates are shown for the
> boxplot and
> not for "points(x,y)"
> Is it possible to show the graph with the (x,y) coordinates with the
> points() function and the boxplots only for the x coordinates. A better
> solution could be to have a seperated y axis on the left side for the
> boxplots().
> 
> Is it possible to do it in this was ?
> 
> 
> 
> 
> Paul Johnson-11 wrote:
> >
> > On Fri, Mar 20, 2009 at 10:02 PM, johnhj <jharris at web.de> wrote:
> >>
> >> Hii,
> >>
> >> Is it possible, to use the plot() funktion and the boxplot()
> funktion
> >> together ?
> >> I will plot a simple graph and additionally to the graph on certain
> >> places
> >> boxplots. I have imagined to plot the graph a little bit
> transparency and
> >> show in the same graph on certain places boxplots....
> >>
> >> Is it possible to do it in this way ?
> >>
> >> greetings,
> >> johnh
> >> --
> >>
> > Run the boxplot first, then use points() or other subsidiary plot
> > functions to add the points in the figure.
> >
> >> y <- rnorm(100)
> >> x <- gl(2,50)
> >> boxplot(x,y)
> >> points(x,y)
> >
> >
> > --
> > Paul E. Johnson
> > Professor, Political Science
> > 1541 Lilac Lane, Room 504
> > University of Kansas
> >
> > ______________________________________________
> > R-help at r-project.org 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.
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/Plot-and-Boxplot-
> in-the-same-graph-tp22632355p22645076.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org 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.




More information about the R-help mailing list