[R] Y values below the X plot

jpardila bluejp at gmail.com
Fri Jun 6 03:34:20 CEST 2008


Thank you Peter :0. This is exactly what I was looking for!!!




Peter Alspach wrote:
> 
> JP
> 
> Try using text() instead of legend().
> 
> HTH ....
> 
> Peter Alspach
>  
> 
>> -----Original Message-----
>> From: r-help-bounces at r-project.org 
>> [mailto:r-help-bounces at r-project.org] On Behalf Of jpardila
>> Sent: Friday, 6 June 2008 1:51 a.m.
>> To: r-help at r-project.org
>> Subject: [R] Y values below the X plot
>> 
>> 
>> Dear List,
>> I am creating a plot and I want to insert the tabular data 
>> below the X axis.
>> I mean for every value of X I want to show the value in Y as 
>> a table below the plot. I think the attached image gives an 
>> idea of what I mean by this. 
>> 
>> Below is the code i am using now... but as you see the Y 
>> values don't have the right location. Maybe I should insert 
>> them as a table? Any ideas on that. This should be easy to do 
>> but I don't have much experience in R. 
>> Many thanks in advanced,
>> JP
>> 
>> http://www.nabble.com/file/p17670311/legend.jpg legend.jpg
>> -------------------------
>> img1<-c(-5.28191709,-5.364480081,-4.829456677,-5.325101503,-5.
> 212952356,-5.181171896,-5.211122693,-5.153677663,-5.292961077,-5.1516123
> 94,-5.056544559,-5.151>
> 457115,-5.332984571,-5.325259917,-5.523870109,-5.429800485,-5.
>> 436455325)
>> img2<-c(-5.55,-5.56,-5.72,-5.57,-5.34,-5.18,-5.18,-5.36,-5.46,
> -5.32,-5.29,-5.37,-5.42,-5.45,-5.75,-5.75,-5.77)
>> angle<-26:42
>> plot(img1~angle, type="o", xlab="Incident angle", 
>> ylab="sigma", ylim=c(-8,-2),lwd=2,col=8, 
>> pch=19,cex=1,axes="false") lines(img2~angle,lwd=2,type="o", 
>> col=1, pch=19,cex=1) legend(38,-2,format(img1,digits=2), cex=0.8)
>> legend(40,-2,format(img2,digits=2),cex=0.8)
>> legend(26, -2, c("Image 1","Image 2"), 
>> cex=0.8,lwd=2,col=c("8","1"), pch=19,
>> lty=1:2,bty="n")
>> abline(h = -1:-8, v = 25:45, col = "lightgray", lty=3)
>> 
>> axis(1, at=2*0:22)
>> axis(2, at=-8:-2)
>> -----------------------------------
>> --
>> View this message in context: 
>> http://www.nabble.com/Y-values-below-the-X-plot-tp17670311p176
>> 70311.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> 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.
>> 
> 
> The contents of this e-mail are privileged and/or confidential to the
> named
>  recipient and are not to be used by any other person and/or organisation.
>  If you have received this e-mail in error, please notify the sender and
> delete
>  all material pertaining to this e-mail.
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Y-values-below-the-X-plot-tp17670311p17682918.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list