[R] Scatter Plot

baptiste auguie baptiste.auguie at googlemail.com
Fri Jul 31 18:48:36 CEST 2009


please Cc. the list next time

Two suggestions,

1) read the help page, e.g. ?points would have told you why pch="10"
produces "1".

2) Try the following and see which you prefer,

x = y = labels = 1:20

?text
plot(x, y, type='n') # empty plot
text(x, y, paste(labels))

library(ggplot2)
?qplot
qplot(x, y, geom="text", label=labels)

library(lattice)
?xyplot
xyplot(y~x, t="n",
   panel = function(...) { panel.text(..., label= labels) } )


HTH,

baptiste

2009/7/31 amna khan <amnakhan493 at gmail.com>:
> Hi Sir
> Your suggested code worked only for numbers 1 to 9 remaining points were
> marked by 1. I want to have numbers 1 to 22 instead of points on scatter
> plot.
> Suggest more.
> Kind Regards

> On Thu, Jul 30, 2009 at 11:57 PM, baptiste auguie
> <baptiste.auguie at googlemail.com> wrote:
>>
>> Hi,
>>
>> Try this,
>>
>> plot(1:5,1:5, t='p', pch=paste(1:5))
>>
>> baptiste
>>
>>
>> 2009/7/30 amna khan <amnakhan493 at gmail.com>:
>> > Dear Sir
>> >
>> > I want to write the numbers 1,2,3,----on a scatter plot instead of
>> > points,
>> > like 1 corresponding to first point on plot, 2 corresponding second
>> > point
>> > etc.
>> > Help in this regard.
>> >
>> > Regards
>> >
>> > --
>> > AMINA SHAHZADI
>> > Department of Statistics
>> > GC University Lahore, Pakistan.
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > 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.
>> >
>
>
>
> --
> AMINA SHAHZADI
> Department of Statistics
> GC University Lahore, Pakistan.
>



-- 
_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

http://newton.ex.ac.uk/research/emag




More information about the R-help mailing list