[R] dot plot

Ivan Calandra ivan.calandra at uni-hamburg.de
Thu Apr 1 09:47:59 CEST 2010


Hi,

It might be too late but I'll answer anyway.
First, don't forget to follow the posting guide and provide some sample 
data, your code, and/or exactly what you're looking for. And as Jannis 
said, search also the archive.

Here are some thoughts about what you can do (if I understand you well):
df <- data.frame(cat=1:10, num1=rnorm(10), num2=rnorm(10))    #sample 
dataframe
plot(df$num1, type="n", xlim=c(1,10), ylim=c(-1,1), xlab="categories", 
ylab="random numbers")         #create a blank plot
points(df$num1, type="p", pch=1, col="red")    #plot "num1"
points(df$num2, type="p", pch=2, col="green")   #plot "num2"
legend(x="topright", legend=c("num1", "num2"), pch=1:2, col=c("red", 
"green"))    #add a legend

HTH,
Ivan



Le 3/31/2010 19:42, Jannis a écrit :
> Hi kayj
>
> kayj schrieb:
>> Also, I do nto know how to combine two plots into one plot?
>>
> Have a look at ?par . There is some argument "add" or "new" (i am not
> sure) that you have to set to TRUE after making the first plot and then
> you can add a second plot with running plot() once more.
>
>> thanks and I appreciate your help
>>
>
> You are welcome. You should search the archive of the help list a bit
> more extensively before posting as this question has been asked several
> times already (this happened to me as well already ;-)).
>
>
>
> Best
> Jannis
>
> ______________________________________________
> 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.
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php



More information about the R-help mailing list