[R] connecting points on a graph

jim holtman jholtman at gmail.com
Wed Sep 30 02:17:18 CEST 2009


Is this close to what you want:

x <- read.table(textConnection("locus min max
K9/10* 70 72
Pcc40 80 81
2F9 84 100
4E8/Pca12 96 108
Pau6 99 103
Pau20 100 113
Pau9 103 129
Pocc1* 104 128
Pau7 105 111"), header=TRUE, as.is=TRUE)
closeAllConnections()
x$row <- seq(nrow(x))
plot(0, type='n', ylim=c(0,max(nrow(x)) + 1), xlim=range(c(x$min, x$max)))
segments(x$min, x$row, x$max, x$row)
points(c(x$max, x$min), c(x$row, x$row), pch=16)
text(x$min, x$row+.5, x$locus)



On Tue, Sep 29, 2009 at 7:01 PM, Jolene Sutton <jolene.sutton at gmail.com> wrote:
> Hi,
>
> I am trying to connect points on a graph that originate from *different
> columns of data*. For each sample I have minimum and maximum data points and
> I would like to draw a line connecting these in order to visualize the
> spread, as well as where each sample is in relation to the x-axis. So far I
> can generate the points, but the only lines I have been able to make join
> all the minimum values together OR all the maximum values together. I would
> like to graph the lines without having manually do one at a time. I have
> included a sample of my data below.
>
> I have attached a PDF file of what I would like the final product to look
> like.
>
> Any suggestions would be greatly appreciated!!
>
> cheers,
> Jolene
>
>
>  locus min max  K9/10* 70 72  Pcc40 80 81  2F9 84 100  4E8/Pca12 96 108
> Pau6 99 103  Pau20 100 113  Pau9 103 129  Pocc1* 104 128  Pau7 105 111
>
>
> --
> Jolene Sutton
>   PhD candidate
>   Department of Zoology
>   University of Otago
>   340 Great King St.
>   PO Box 56
>   Dunedin 9054
>   New Zealand
>
>   Fax: (64) 3-479-7584
>   Cell: (64) 027-261-6121
>   E-mail: jolene.sutton at gmail.com
>
>   www.erg.otago.ac.nz
>
> ______________________________________________
> 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.
>
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list