Re: [R] How to add characters on graph ?

From: jim holtman <jholtman_at_gmail.com>
Date: Wed 03 Jan 2007 - 12:44:37 GMT

This should do it. You can play around with the alignment of the labels.

input <- ' 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

'

# read in the data
inData <- read.table(textConnection(input), header=TRUE) with(inData, {

    plot(lb,index, pch=1, col=5,cex=1, lwd=2,

        xlab="LB", ylab="Index",cex.main =1,font.main= 1, main="scatterplot")

    text(lb[index > 1.5], index[index > 1.5], labels=ID[index > 1.5]) # label the outliers
})

On 1/3/07, Jenny persson <jenny197806@yahoo.se> wrote:
>
> 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@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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
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.
Received on Wed Jan 03 23:51:38 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 03 Jan 2007 - 15:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.