Mike,
If depth is positive downward, you can simply plot its negative. Fir
example, suppose you have a dataframe with ctd data:
> ctd[1,]
id p t s
104613 5993512 2 25.248 36.238 > unique(ctd$id)
[1] 5993512 3319148 3358648 3358538 3317809 3317562 3304786 3300555
3313863
[10] 3317901 3249908 3249987
If you are not fussy about the axis labels indicating negative values
of pressure, you can plot them like this:
xyplot(-p~t|factor(id),
data=ctd,
type="l",
xlab="temperature (C)",
ylab="pressure (dbar)")
If you want to get rid of the minus signs:
xyplot(-p~t|factor(id),
data=ctd,type="l",
xlab="temperature (C)",
ylab="pressure (dbar)",
scales=list(y=list(at=seq(-3000,0,by=500),
labels=format(-seq(-3000,0,by=500)))))
Hope this helps.
Carlisle
--
William Carlisle Thacker
Atlantic Oceanographic and Meteorological Laboratory
4301 Rickenbacker Causeway, Miami, Florida 33149 USA
Office: (305) 361-4323 Fax: (305) 361-4392
"Too many have dispensed with generosity
in order to practice charity." Albert Camus
> Subject: [R] Oceanographic lattice plots?
> Date: Sat, 18 Oct 2003 14:14:14 -0400
> From: "Mike Prager" <Mike.Prager at noaa.gov>
> To: R Help List <r-help at stat.math.ethz.ch>
> CC: Michael Prager <Mike.Prager at noaa.gov>
>
> R 1.8.0 on Windows XP Professional. A huge THANK YOU to the R Team for
> this marvelous software.
>
> I am making lattice plots of oceanographic data. The usual layout does not
> conform to plotting conventions that marine scientists use when depth is
> the independent variable. Under those conventions, plots are made with the
> origin at the upper left, depth on the vertical axis (increasing as it goes
> down), and the dependent variable on the horizontal axis (increasing to the
> right).
>
> That convention has implications not just in how axes are labeled and set
> up, but also when using smoothing routines such as panel.lowess(), because
> the smoothed values are on the horizontal axis, not the vertical axis.
>
> Before I start looking at and modifying the R code that makes up the
> relevant routines, I wonder if any reader has already developed R routines
> for this purpose?
>
> --
> Michael Prager, Ph.D.
> NOAA Beaufort Laboratory
> Beaufort, North Carolina 28516
> http://shrimp.ccfhrb.noaa.gov/~mprager/
> ***
>
> ----------------------------------------------------------------------
>
> Subject: Re: [R] Oceanographic lattice plots?
> Date: Sat, 18 Oct 2003 13:29:14 -0500
> From: Deepayan Sarkar <deepayan at stat.wisc.edu>
> To: "Mike Prager" <Mike.Prager at noaa.gov>,
> R Help List <r-help at stat.math.ethz.ch>
> CC: Michael Prager <Mike.Prager at noaa.gov>
> References: <6.0.0.22.0.20031018140413.01b88508 at
hermes.nos.noaa.gov>
>
> On Saturday 18 October 2003 13:14, Mike Prager wrote:
> > R 1.8.0 on Windows XP Professional. A huge THANK YOU to the R Team
for
> > this marvelous software.
> >
> > I am making lattice plots of oceanographic data. The usual layout
does not
> > conform to plotting conventions that marine scientists use when depth
is
> > the independent variable. Under those conventions, plots are made
with the
> > origin at the upper left, depth on the vertical axis (increasing as it
goes
> > down), and the dependent variable on the horizontal axis (increasing
to the
> > right).
>
> In case you decide to work on this yourself, this might be useful:
>
> Ideally, specifications like
>
> xyplot(depth ~ x, ylim = c(10, 0))
>
> should reverse the y-axis direction. As pointed out some time back, this
> doesn't work in lattice currently, but that should be fixed in the
future (it
> already works in my development version).
>
> > That convention has implications not just in how axes are labeled and
set
> > up, but also when using smoothing routines such as panel.lowess(),
because
> > the smoothed values are on the horizontal axis, not the vertical axis.
>
> These should be easy to modify.
>
> Deepayan
>
> > Before I start looking at and modifying the R code that makes up the
> > relevant routines, I wonder if any reader has already developed R
routines
> > for this purpose?
>
> ----------------------------------------------------------------------