[R] How to add characters on graph ?
Greg Snow
Greg.Snow at intermountainmail.org
Wed Jan 3 17:21:42 CET 2007
If you just want to label and identify outliers after creating a plot
then look at the identify function. In your case you could just run the
following command after creating your plot:
> out.index <- identify( c$lb, c$index )
Then click on (or near) the outliers or other interesting points. The
points will be labelled on the plot and their position in the dataset
will be saved in out.index.
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 Jenny persson
> Sent: Wednesday, January 03, 2007 4:55 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] How to add characters on graph ?
>
> Dear R-users,
>
> I have following data
>
>
> # Plot coloured scatter plot
>
> c<-dat[100:110,c(5,7,8)]
>
> par(mfrow=c(3,2))
> plot(c$lb,c$index, pch=1, col=5,cex=1, lwd=2,
> xlab="LB", ylab="Index",cex.main =1,font.main= 1,
> main="scatterplot")
>
> ID index lb
> 100 FLINDYTHNIPLI 1.84770221 9.087463
> 101 none 0.06657547 8.927778
> 102 GDDKVYSANGFTT -0.22922544 8.599913
> 103 GDFTQGPQSAKTR 0.01203925 8.483816
> 104 GDKEFSDALGYLQ -0.06264494 8.463524
> 105 GDPTETLRQCFDD -0.10011148 8.483816
> 106 GDSGGSFQNGHAQ -0.13460447 8.442943
> 107 GDVYSFAIIMQEV 1.91504700 8.413628
> 108 GLRSLYPPPPPPQ -0.11224126 8.383704
> 109 GLWVTYKAQDAKT 0.03723291 8.257388
> 110 GMSQPLLDRTVPD -0.06580206 8.294621
>
> When I plotted a scatter plot of index against lb, there
> are two extreme values. How can I plot so that these values
> are replaced by their ID or the IDs are next to these values
> on the graph? I want to do something like: if index > 1.5
> then plot the IDs instead of the indexes greater than 1.5 or
> place the Ids next to their indexes.
> The data above is a little part of my real data (which
> might have more than two extreme outliers).
>
> Thanks for your help,
>
> Jenny
>
> __________________________________________________
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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