[R] divided scatter plots
Greg Snow
Greg.Snow at intermountainmail.org
Thu Aug 23 18:57:08 CEST 2007
Does the following code do something like what you want (but with the
built in data):
> plot(as.integer(state.region), state.x77[,'Murder'],
+ xaxt='n', xlim=c(0,5), col=as.integer(state.region))
> axis(1, at=1:4, labels=levels(state.region))
>
> oo <- order(order( as.integer(state.region), state.x77[,'Murder'] ))
>
> tmp.p <- rep( c(2,4), length=50 )[oo]
>
> text(as.integer(state.region), state.x77[,'Murder'], state.name,
pos=tmp.p,
+ col=as.integer(state.region))
>
If that is not what you want, then maybe you could give us some more
detail so we can better understand.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Caroline Nganga
> Sent: Tuesday, August 21, 2007 11:01 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] divided scatter plots
>
> I have a data set which contains two columns. The first
> column is a list of countries, and the second column contains
> their political risk ratings. I would like to create one
> large plot that contains 5 different sections, each with a
> scatter plot. To clarify, I have divided the countries into 5
> groups. For each group (continent), I would like to have the
> name of the continent on the x-axis, and points representing
> countries and their risk rating on the y-axis. However, I
> want all 5 scatter plots to be in one large plot. What
> function should I use to do this? Also, is it possible to
> label each point?
> thanks for any help!
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list