Quantcast

How to display data values for points in a plot?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to display data values for points in a plot?

Nish
Hello,

I would like to know how to display values for points in a plot funtion. For example,

plot( y=dat$a,
      x=dat$b,
  main="plot1",
    ylab="a",
      xlab="b",
  ylim=c(-10, 10),
        xlim=c(-10, 10),
  type = "p",
  pch=17,
  col=<vector of colors depending on the value of "b">,
        cex=1.5
 )

How can I add a label to each of points here, if I have a list of values associated with the point.

Thanks in advance.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to display data values for points in a plot?

Erik Iverson-3


Nish wrote:

> Hello,
>
> I would like to know how to display values for points in a plot funtion. For
> example,
>
> plot( y=dat$a,
>       x=dat$b,
>   main="plot1",
>     ylab="a",
>       xlab="b",
>   ylim=c(-10, 10),
> xlim=c(-10, 10),
>   type = "p",
>   pch=17,
>   col=<vector of colors depending on the value of "b">,
> cex=1.5
>  )
>
> How can I add a label to each of points here, if I have a list of values
> associated with the point.
>
Please provide self-contained, reproducible code.

Maybe ?text is what you want?

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to display data values for points in a plot?

Jim Lemon
Nish wrote:
>  ...
> I would like to know how to display values for points in a plot
> funtion. For
> example,
>  ...
> How can I add a label to each of points here, if I have a list of values
> associated with the point.

Hi Nish,
Have a look at thigmophobe.labels in the plotrix package.

Jim

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to display data values for points in a plot?

Greg Snow-2
In reply to this post by Nish
It depends on what you mean by display values.  In addition to the other suggestions also look at the identify function as well as TkIdentify and HTKidentify in the TeachingDemos package.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[hidden email]
801.408.8111


> -----Original Message-----
> From: [hidden email] [mailto:r-help-bounces@r-
> project.org] On Behalf Of Nish
> Sent: Thursday, May 13, 2010 10:33 AM
> To: [hidden email]
> Subject: [R] How to display data values for points in a plot?
>
>
> Hello,
>
> I would like to know how to display values for points in a plot
> funtion. For
> example,
>
> plot( y=dat$a,
>       x=dat$b,
>   main="plot1",
>     ylab="a",
>       xlab="b",
>   ylim=c(-10, 10),
> xlim=c(-10, 10),
>   type = "p",
>   pch=17,
>   col=<vector of colors depending on the value of "b">,
> cex=1.5
>  )
>
> How can I add a label to each of points here, if I have a list of
> values
> associated with the point.
>
> Thanks in advance.
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-
> display-data-values-for-points-in-a-plot-tp2197796p2197796.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to display data values for points in a plot?

daltieri
In reply to this post by Nish
See

?text

Hope it works for you.
Loading...