[R] Display of data points in the Scatterplot

Peter Ehlers ehlers at ucalgary.ca
Sun Dec 23 03:50:07 CET 2012


On 2012-12-19 12:31, David Winsemius wrote:
>
> On Dec 19, 2012, at 11:28 AM, Katherine Gobin wrote:
>
>> Respected R forum
>>
>> I am learning R and relatively quite new to R. I am generating a scatter-plot as given below. (My actual table is much larger).
>>
>>
>>
>> # Sample data frame
>>
>>
>> y = c(20, 23, 17, 31, 68)
>> x = c(200, 300, 400, 500, 600)
>>
>> plot(x, y, type = 'l')
>>
>> If I plot this scatter-plot in excel, the data values are displayed if I place the cursor at some desired place of the graph. E.g. if I place the cursor say at the point (400, 31), then the value (400, 31) is displayed.
>>
>> My question(s) are
>
> .... easily answered by looking at the help pages.
>
>> (A) once I plot a graph in R, is it possible to display a particular (x, y) co-ordinate by placing the cursor there?
>
> ?locator

Shouldn't that be ?identify?
And the OP might also want to check out the HWidentify/HTKidentify
functions in the TeachingDemos package.

Peter Ehlers

>
>>
>> (B) Suppose I have 100 pairs of (x, y ). then is it possible to display  in the graph (irrespective of the curosr position) the values of (x,  y) corresponding to say 10th, 20th, 30th, 40th etc. observations in the graph.
>
> ?text
> ?"%/%
>
>




More information about the R-help mailing list