[R] Three plots with logged X-axis in the same plot

John Kane jrkrideau at inbox.com
Thu May 16 15:28:11 CEST 2013


Okay so you do want independent panels. 

When I asked for sample data it does not have to be anything real. All we need is something that has a similar data structure. We can do the same type of graph with earhquake data, medical data or  voter response.  

Just substite random names for the med terms and use a random number generator for the meaurements.  This , length of vectors in different matrices or dataframes, etc are the crucial bits of information. The actual data is really immaterial.

For example here are two different data structures with the "almost the same data but in different formats and with an important difference between dat1$aa and dat2$aa.  

 dat1  <-  structure(list(aa = structure(1:5, .Label = c("a", "b", "c", 
"d", "e"), class = "factor"), bb = c(-0.00582694254724667, -0.716808619114487, 
0.0333078304958157, 0.382137504304074, -1.07626847615088)), .Names = c("aa", 
"bb"), row.names = c(NA, -5L), class = "data.frame")
  
  dat2  <- structure(list(aa = c("a", "b", "c", "d", "e"), bb = c(0.149330272058851, 
0.4024610008935, -1.10212110787262, -0.603049153794929, 0.894804687148742
)), .Names = c("aa", "bb"))

  str(dat1)
  str(dat2)











John Kane
Kingston ON Canada


> -----Original Message-----
> From: patrik.ohagen at mpa.se
> Sent: Thu, 16 May 2013 13:09:26 +0000
> To: jrkrideau at inbox.com, r-help at r-project.org
> Subject: SV: [R] Three plots with logged X-axis in the same plot
> 
> 
> 
> Hi John, Thank you for your input! The thing is that the graph would be
> to messy if I plotted all the data in a single plot. I wish I could share
> some data but I am all of the stuff is highly confidential. Sorry.
> 
> 
> Cheers, Patrik
> 
> -----Ursprungligt meddelande-----
> Från: John Kane [mailto:jrkrideau at inbox.com]
> Skickat: den 16 maj 2013 14:53
> Till: Öhagen Patrik; r-help at r-project.org
> Ämne: RE: [R] Three plots with logged X-axis in the same plot
> 
> Can you supply us with a bit of sample data?  It's not clear from your
> description of the problem if you are working with equivalent x -scales
> where it would be very easy to just plot all curves on one plot or if
> there are scale or item differences that might require diffferent panels.
> 
> https://github.com/hadley/devtools/wiki/Reproducibility
> 
> John Kane
> Kingston ON Canada
> 
> 
>> -----Original Message-----
>> From: patrik.ohagen at mpa.se
>> Sent: Thu, 16 May 2013 11:50:20 +0000
>> To: r-help at r-project.org
>> Subject: [R] Three plots with logged X-axis in the same plot
>> 
>> I have, say, three plots with several medical terms on the y-axis
>> plotted
>> against HR's on a log-scaled x-axis. In order to highlight the time
>> profile for the different plots, I would like to "merge" (put them next
>> to each other, if that makes sense) together the log scaled x-axises and
>> present the data in a single plot.
>> 
>> How to do it? Using par(mfrow=c(1,3)) seems to waste too much printing
>> area.
>> 
>> Any suggestions?
>> 
>> Thank you in advance!
>> 
>> Cheers, Patrik
>> 
>> 
>> 	[[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!
> Check it out at http://www.inbox.com/earth

____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails



More information about the R-help mailing list