Wesley Roberts
2007-Aug-14 13:57 UTC
[R] labelling plots with ancillary data in data.frame
Hi All, I am busy using R to do some regression modelling and have been using plot(x,y,"") to visualise my variables. I would now like to label my points using data stored in the data.frame used for the regression analysis. For example each of my data points is made up of a field measured forest volume value and a remotely sensed vegetation estimate (NDVI). Each point is an enumeration plot and I would like to label each the points in the xy-scatterplot with their respective plot numbers. Is this possible in R, if so how do I go about doing it? Many thanks for your help Wesley Wesley Roberts MSc. Researcher: Forest Assessment (Remote Sensing & GIS) Forestry and Forest Products Research Centre CSIR Tel: +27 (31) 242-2353 Fax: +27 (31) 261-1216 http://ffp.csir.co.za/ "To know the road ahead, ask those coming back." - Chinese proverb -- This message is subject to the CSIR's copyright, terms and conditions and e-mail legal notice. Views expressed herein do not necessarily represent the views of the CSIR. CSIR E-mail Legal Notice http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html CSIR Copyright, Terms and Conditions http://mail.csir.co.za/CSIR_Copyright.html For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR Legal Notice send a blank message with REQUEST LEGAL in the ...{{dropped}}
Hi Wesley, Try the text() function. An example: a = rep(10,10) b = seq(1,10) plot(a,b) text(a,b, labels = b, pos = 4, offset = 0.7) ?text hth, Paul Wesley Roberts schreef:> Hi All, > > I am busy using R to do some regression modelling and have been using plot(x,y,"") to visualise my variables. I would now like to label my points using data stored in the data.frame used for the regression analysis. For example each of my data points is made up of a field measured forest volume value and a remotely sensed vegetation estimate (NDVI). Each point is an enumeration plot and I would like to label each the points in the xy-scatterplot with their respective plot numbers. Is this possible in R, if so how do I go about doing it? > > Many thanks for your help > > Wesley > > Wesley Roberts MSc. > Researcher: Forest Assessment (Remote Sensing & GIS) > Forestry and Forest Products Research Centre > CSIR > Tel: +27 (31) 242-2353 > Fax: +27 (31) 261-1216 > http://ffp.csir.co.za/ > > "To know the road ahead, ask those coming back." > - Chinese proverb > > >-- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +31302535773 Fax: +31302531145 http://intamap.geo.uu.nl/~paul
Hi Wesley, You can use the text() function to add text to an existing plot. See ?text. Julian Wesley Roberts wrote:> Hi All, > > I am busy using R to do some regression modelling and have been using plot(x,y,"") to visualise my variables. I would now like to label my points using data stored in the data.frame used for the regression analysis. For example each of my data points is made up of a field measured forest volume value and a remotely sensed vegetation estimate (NDVI). Each point is an enumeration plot and I would like to label each the points in the xy-scatterplot with their respective plot numbers. Is this possible in R, if so how do I go about doing it? > > Many thanks for your help > > Wesley > > Wesley Roberts MSc. > Researcher: Forest Assessment (Remote Sensing & GIS) > Forestry and Forest Products Research Centre > CSIR > Tel: +27 (31) 242-2353 > Fax: +27 (31) 261-1216 > http://ffp.csir.co.za/ > > "To know the road ahead, ask those coming back." > - Chinese proverb > > >-- Julian M. Burgos Fisheries Acoustics Research Lab School of Aquatic and Fishery Science University of Washington 1122 NE Boat Street Seattle, WA 98105 Phone: 206-221-6864