[R] plotting labels (not values) on xy plot
tdm
philb at philbrierley.com
Tue Oct 20 05:17:30 CEST 2009
Thanks Jim - that worked.
Jim Lemon-2 wrote:
>
> On 10/20/2009 01:10 PM, tdm wrote:
>> I have 2 vectors, x and y and have done an xy plot.
>>
>> I want to plot the label (name?) of the vector on the plot rather than
>> the
>> value.
>>
>> text(x,y, labels = x)
>>
>> gives me the value of x.
>>
>> text(x,y, labels = labels(x))
>>
>> gives me something like c("text1","text2"..) plotted for each point
>>
>> text(x,y, labels = names(x))
>>
>> gives nothing
>>
>> print(x) gives me
>>
>> [,1]
>> text1 0.000000000
>> text2 0.000000000
>> text3 -0.029027359
>> text4 -0.088602806
>>
>>
>> so how do 'text1' written rather than the value? I know there is a way
>> but I
>> am just guessing at the moment.
>>
>> Any pointers greatly appreciated.
>>
>>
>>
>>
>>
>>
> Hi Phil,
> It looks like you have a 4x1 matrix. My first guess would be:
>
> text(x,y,rownames(x))
>
> Jim
>
> ______________________________________________
> 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/plotting-labels-%28not-values%29-on-xy-plot-tp25968696p25969146.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list