Caroline Nganga wrote:
> 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!
> 
Hi Caroline,
If I understand your request, you might be able to use the axis.break 
function in the plotrix package. That is, you make one big plot with the 
points in five columns and then put gap style axis breaks between the 
columns. Here's a toy example:

library(plotrix)
prr.df<-data.frame(country=c("us","mx","ca","br","ar","pe",
  "ch","mn","in","nl","fr","es","na","mz","rw"),
  continent=c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5),
  prr=rnorm(15)+4)
plot(prr.df$continent,prr.df$prr,main="Political risk ratings",
  xlim=c(0.7,5.3),xlab="Continent",ylab="Risk rating",type="n")
text(prr.df$continent,prr.df$prr,prr.df$country)
axis.break(1,1.5,style="gap")
axis.break(1,2.5,style="gap")
axis.break(1,3.5,style="gap")
axis.break(1,4.5,style="gap")

Jim

______________________________________________
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.

Reply via email to