[R] qplot: plotting precipitation data

John Kane jrkrideau at inbox.com
Sun Sep 16 01:20:44 CEST 2012


Thanks for the data. It makes things much easier.

Do you want a bar chart (i.e. geom  = bar in qplot or geom_bar in ggplot)? That sounds like what you mean when you speak of rectangles.  

If so try this ggplot) command -- I almost never use qplot() so I am not quite sure how to specify it there.

p  <-  ggplot(mydata , aes(as.factor(start), peak )) + geom_bar(stat= "identity", )
p


John Kane
Kingston ON Canada


> -----Original Message-----
> From: hnorpois at googlemail.com
> Sent: Sat, 15 Sep 2012 18:39:54 +0200
> To: r-help at r-project.org
> Subject: [R] qplot: plotting precipitation data
> 
> Dear list,
> 
> I wish to plot chromatin precipitation data: I would like to have a
> rectangles (x:end-start, y:peak) but I do not have an idea how to define
> x
> (in terms of qplot syntax) and to choose the correct geom.
>  mydata is a subset of a larger file.
> 
>> mydata
>   chrom    start      end       peak
> 1 chr11  5291000  5291926    8
> 2 chr11 10988025 10988526    7
> 3 chr11 11767950 11768676    8
> 4 chr11 11840900 11841851    8
> 5 chr11 12267450 12268076   12
> 6 chr11 12276675 12277051    7
>> dput(mydata)
> structure(list(chrom = structure(c(3L, 3L, 3L, 3L, 3L, 3L), .Label =
> c("chr1",
> "chr10", "chr11", "chr12", "chr13", "chr14", "chr15", "chr16",
> "chr17", "chr18", "chr19", "chr2", "chr3", "chr4", "chr5", "chr6",
> "chr7", "chr8", "chr9", "chrX"), class = "factor"), start = c(5291000L,
> 10988025L, 11767950L, 11840900L, 12267450L, 12276675L), end = c(5291926L,
> 10988526L, 11768676L, 11841851L, 12268076L, 12277051L), peak = c(8L,
> 7L, 8L, 8L, 12L, 7L)), .Names = c("chrom", "start", "end", "peak"
> ), row.names = c(NA, -6L), class = "data.frame")
>> 
> 
> Thanks for some instructions.
> 
> Hermann Norpois
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

____________________________________________________________
FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!




More information about the R-help mailing list