Re: [R] How to plot two variables using a secondary Y axis

2007-07-11 Thread hadley wickham
On 7/10/07, Felipe Carrillo [EMAIL PROTECTED] wrote:
   Date  Fo  Co6/27/2007  57.1  13.96/28/2007  57.7  14.3
 6/29/2007  57.8  14.36/30/2007  57  13.97/1/2007  57.1  13.9
 7/2/2007  57.2  14.07/3/2007  57.3  14.17/4/2007  57.6  14.2
 7/5/2007  58  14.47/6/2007  58.1  14.57/7/2007  58.2  14.6
 7/8/2007  58.4  14.77/9/200758.7
 14.8

   Hello all:
   I am a newbie to R, and I was wondering how can I plot the Temperature 
 values above using Lattice or ggplot2 code. I want Date(X axis), Degrees F(Y 
 axis) and Degrees C( on a secondary Y axis).

Hi Felipe,

It's not currently possible with ggplot2, but it is something on my to do list.

Hadley

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to plot two variables using a secondary Y axis

2007-07-10 Thread Sundar Dorai-Raj


Felipe Carrillo said the following on 7/10/2007 7:58 AM:
   Date  Fo  Co6/27/2007  57.1  13.96/28/2007  57.7  14.3
 6/29/2007  57.8  14.36/30/2007  57  13.97/1/2007  57.1  13.9
 7/2/2007  57.2  14.07/3/2007  57.3  14.17/4/2007  57.6  14.2
 7/5/2007  58  14.47/6/2007  58.1  14.57/7/2007  58.2  14.6
 7/8/2007  58.4  14.77/9/200758.7
 14.8

   Hello all:
   I am a newbie to R, and I was wondering how can I plot the Temperature 
 values above using Lattice or ggplot2 code. I want Date(X axis), Degrees F(Y 
 axis) and Degrees C( on a secondary Y axis). 
   Thanks




For lattice, see this thread:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/102768.html

HTH,

--sundar

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to plot two variables using a secondary Y axis

2007-07-10 Thread Gabor Grothendieck
We assume the Fo and Co represent the same data except in different
units (this seems to be approximately the case) so there is really
only one variable being measured here.  If that's not the case let
me know. Below we read the data, define enough padding around plot
to do what we want, call xyplot, draw the right axis and add the right
y lablel.

library(lattice)
library(grid)  # needed for grid.text

# data

Lines.raw - Date  Fo  Co
6/27/2007  57.1  13.9
6/28/2007  57.7  14.3
6/29/2007  57.8  14.3
6/30/2007  57  13.9
7/1/2007  57.1  13.9
7/2/2007  57.2  14.0
7/3/2007  57.3  14.1
7/4/2007  57.6  14.2
7/5/2007  58  14.4
7/6/2007  58.1  14.5
7/7/2007  58.2  14.6
7/8/2007  58.4  14.7
7/9/200758.7 14.8

# in reality next stmt would be DF - read.table(myfile.dat, header = TRUE)
DF - read.table(textConnection(Lines.raw), header = TRUE)
DF$Date - as.Date(DF$Date, %m/%d/%Y)

par.settings - list(
layout.widths = list(left.padding = 10, right.padding = 10),
layout.heights = list(bottom.padding = 10, top.padding = 10)
)

xyplot(Co ~ Date, DF, default.scales = list(y = list(relation = free)),
ylab = C, par.settings = par.settings)

trellis.focus(panel, 1, 1, clip.off = TRUE)
  pr - pretty(DF$Fo)
  at - 5/9 * (pr - 32)
  panel.axis(right, at = at, lab = pr, outside = TRUE)
  grid.text(F, x = 1.1, rot = 90) # right y axis label
trellis.unfocus()



On 7/10/07, Felipe Carrillo [EMAIL PROTECTED] wrote:
  Date  Fo  Co6/27/2007  57.1  13.96/28/2007  57.7  14.3
 6/29/2007  57.8  14.36/30/2007  57  13.97/1/2007  57.1  13.9
 7/2/2007  57.2  14.07/3/2007  57.3  14.17/4/2007  57.6  14.2
 7/5/2007  58  14.47/6/2007  58.1  14.57/7/2007  58.2  14.6
 7/8/2007  58.4  14.77/9/200758.7
14.8

  Hello all:
  I am a newbie to R, and I was wondering how can I plot the Temperature 
 values above using Lattice or ggplot2 code. I want Date(X axis), Degrees F(Y 
 axis) and Degrees C( on a secondary Y axis).
  Thanks










 -

[[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
 and provide commented, minimal, self-contained, reproducible code.


__
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
and provide commented, minimal, self-contained, reproducible code.