Re: [R] R newbie

From: jim holtman <jholtman_at_gmail.com>
Date: Tue 11 Jul 2006 - 10:44:21 EST

Does this do what you want:

x <- "Exon    start           end
5'UTR   22540060        22540121
1       22540122        22540140
2       22540303        22540493
3       22541552        22541565
4       22542373        22542519
5       22544265        22544432
3'UTR   22544433        22544856"

y <- read.table(textConnection(x), quote='', header=TRUE)

# create the plot area
plot(range(y$start, y$end), c(1,7), type='n', xaxt='n', yaxt='n',

    ylab='', xlab='')

# create the colored rectangles
rect(y$start, 1, y$end, 2, col=c('red', rep('green', nrow(y)-2), 'red'))

# put labels at midpoints of rectangles
axis(1, at=(y$start + y$end)/2, labels=as.character(y$Exon))

On 7/10/06, kannaiah@bsd.uchicago.edu <kannaiah@bsd.uchicago.edu> wrote:
>
> Hello,
>
> I am new to R and still feeling my way thru it.
>
> I am trying to plot the values from this file below on the X-axis of a
> plot. I
> have attached the graph to the email...the one i am trying to recreate.
>
> Exon start end
> 5'UTR 22540060 22540121
> 1 22540122 22540140
> 2 22540303 22540493
> 3 22541552 22541565
> 4 22542373 22542519
> 5 22544265 22544432
> 3'UTR 22544433 22544856
>
>
> I would like to create small rectangles on the x-axis as colored boxes
> from
> start position to end position of each exon...with the label showing 1, 2
> etc
> under each respective exon.
>
> The 5' and 3' UTR would be colored different from the exons 1-5.
>
>
> Any suggestions and ideas would greatly appreciated.
>
> Thank you
> Kiran
>
>
> -------------------------------------------------
> This email is intended only for the use of the individual or entity to
> which
> it is addressed and may contain information that is privileged and
> confidential. If the reader of this email message is not the intended
> recipient, you are hereby notified that any dissemination, distribution,
> or
> copying of this communication is prohibited. If you have received this
> email
> in error, please notify the sender and destroy/delete all copies of the
> transmittal. Thank you.
> -------------------------------------------------
>
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Jul 11 14:09:13 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 11 Jul 2006 - 16:15:56 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.