Closed pbrewin closed 11 years ago
Thanks, I'll add it. Note that you'll need to be able to build from source (and download the latest version from this site) to get the feature.
In the meantime, try e.g.
plotTS(station1)
points(station2[["salinity"]], station2[["temperature"]], col='red')
etc.
Actually, this works in the present development version of oce (i.e. the development
branch here), as the following code illustrates:
library(oce)
data(ctd)
ctd2 <- ctd
ctd2[['temperature']] <- ctd2[['temperature']] + 1
plotTS(ctd)
plotTS(ctd2, add=TRUE, col='red')
Hi - yes, I got that far with plotTS. I was wondering if the "add=T" parameter was available in plot.ctd? so using your example,
plot(ctd, which=10) plot(ctd2,which=10,add=T)
For me, this redraws the plot, rather than adding a new profile. Cheers, PB
On 2012-12-05, at 9:25 AM, pbrewin notifications@github.com wrote:
Hi - yes, I got that far with plotTS. I was wondering if the "add=T" parameter was available in plot.ctd? so using your example,
plot(ctd, which=10) plot(ctd2,which=10,add=T)
For me, this redraws the plot, rather than adding a new profile. Cheers, PB
Oh, I see. I could do what you want, but there is a sort of trick because a person might do
... which=1 ...
... which=2, add=TRUE ...
and get odd results. But, I take your point, and I'll add this.
Thanks!
Thanks - I'll keep an eye out for an update. Nice work putting oce together by the way!
The present version of develop
handles this, although I've not done extensive testing. NOTE: there is no way to specify colours in the added plots, because of a problem with a hierarchy of argument passing. I don't quite see how to fix the colour problem quickly -- and I think the solution may involve some argument renaming -- so I am leaving this for now. To get colours, you can always do e.g.
plot(ctd, which="temperature")
points(ctd2[["temperature"]], ctd2[["pressure"]], col='red')
and so forth. Indeed, I think it's better to work that way, which is closer to the R paradigm, I think, isolating a plot call (with possibility to control axes, margins, etc) from an addition call.
If you find that the solution works (apart from the colour issue), please close the issue.
Thanks for the idea!!
Ok, so you're example works well - you can also say type="l" if you want a line instead of points. However I can't make it work with my data - it looks like the points command is trying to plot a horizontal line at about 5 meters depth - probably thinking its plotting 5 degrees C. I've emailed you a screenshot of the plot and the code leading up to the plot - simply its loading a file (Seabird asc file), converting it to a ctd object, then plotting.
Would be helpful to be able to have multiple casts in one profile plot.