Closed paul736 closed 3 years ago
Hi Paul
For "non-standard" plot types you should just be able to use xlim=
to set the limits to a desired range.
I'm not at a computer right now so can't check to be sure.
Clark
I just checked, and xlim
is not working for me. But I might be using the CRAN version of oce, because I'm also not getting proper labels on the axis. I'll check into this.
@paul736 are you able to build oce from source? You'll need to do that, if (as might be the case) I need to tweak plotProfile()
to obey xlim
.
Are we talking about plot,CTD-method
or specifically plotProfile()
. Because I feel like the latter works, so would be better to use in a custom plot function anyway.
The business with Tlim and Slim etc was to allow control in a single plot(CTD, which=)
call, which is always hard to capture all cases with arguments.
here is the error. Error: in plot,ctd-method() : 'xlim' not allowed; use Slim, Tlim, etc thanks!
Oh, I was wrong. plotProfile
actually does work. Click the Details token below, to see a detailed example that is created with the reprex::reprex()
scheme. Also, @paul736, it would be great if you could use reprex::reprex()
to show us what you're doing. (It ought to not use local data ... that's why mine makes up a fake column and adds it to a built-in dataset.)
Note that my test is done with the oce that is on github, not the one on CRAN. You can install this version with
remotes::install_github("dankelley/oce", ref="develop")
if your system is set up to build packages from source.
The problem with xlim
in the plot,ctd-method
is that with multi panels the xlim is too ambiguous. Hence the advice to just use eg par(mfrow=c(2, 2))
and then a series of plotProfile()
calls.
richardsc / dan - You're right - I've got plotProfile working - almost...
plotProfile(ctd.object, xtype = "Fluorescence", xlim=c(0,10), plim=c(10,0), type="n")
But type="n" does not supress the plot? Is there a different setting?
but the
I might need to alter it to make type
work. Give me 15 minutes.
What about type"l", lwd=NA
?
Ah, I see I can add=T, so I'm good for now. Thanks.
Just to note that in plot,CTD-method the x axis label comes up nicely with [units] that I've added to the metadata. PlotProfile does not seem to. But I assume I can build a xlab from scratch. Reading through the rest of PlotProfile details now.
I have plotProfile(...,type="n")
working on the "develop" branch commit 66305183b603b920e6bad677fa6c2a97b3fc1753 now; a reprex is below.
The comment I just posted demonstrates that plotProfile()
names the axis. Again, this is the oce on github.
Yes add=TRUE
is a lifesaver (I recommend using TRUE and not T ... you might actually code a variable named T at some point).
The xlab in plotProfile I think was just fixed, so might require the develop version from GitHub.
Yes it was just fixed in #1785
Thanks very much to you both for fixes and advice. Grabbing the github version now. A productive Friday night. cheers.
Hi Dan - looks like I can't grab from github - getting errors after several attempts. Can I send you a private message?
Hi @dankelley - looks like I can't grab from github - getting errors after several attempts. Can I send you a private message?
It's best to post the errors here (put a line containing the string <details>
, then a blank line then the long output) because then other users might see the problem with your system. I only use oce on one machine (macos) and I have no problems so I am unlikely to know how to help.
Hi Paul -- what OS are you on? Did you try the instructions using the remotes
package posted at
https://dankelley.github.io/oce/
If you're on Windows, you should only need to install RTools from the r-project website and it should work.
On Linux (Ubuntu or similar) the below instructions might help:
If OSX, we might need Dan to weigh in.
OK. I 've pasted the error below (Windows 10. R 4.0.4, Rstudio). When it asks to update packages, I've tried all options - in the example below I've chose to update none. I've updated everything else. This has worked in the past, so not sure whats going on now. @richardsc I tried loading Rtools but it seems its not compatible with R4.0.4, and I've stepped back to 4.0.0 but still no joy.
Huh, that's not one I've seen before, but I tend to be a few versions behind on R (because I'm lazy/conservative ...).
You're definitely going to need Rtools, since it has the compilers required to build from source. You'll have to download from here and follow the install instructions:
https://cloud.r-project.org/bin/windows/Rtools/
Another option you can try is that the POSIX thing seems to only be a warning, which devtools/remotes converts to errors (to be nice and cautious), and that behaviour can be changed by doing the following in the R console before installing:
Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS"=TRUE)
Hope that works
Thank for pointing the way there. Installing RTools40 (plus had to set the path), and setting the TZ worked. Thanks!
Yes! Glad to hear it.
If you think that the issue (as described by the title) has been addressed, feel free to close (we like to leave that up to the reporters to make sure everything is addressed). If something related comes up, you can always re-open this issue, or open a new one if it's a different problem.
Have a great weekend!
Hi Dan - I have a ctd object that I've added fluorescence data to using ctd.object<-oceSetData(ctd.object, name="Fluorescence", value=dat.ctd$fluoro, unit=list(unit=expression(mg/m^3), scale=""))
I'm now building a custom plot from this object and other similar objects such that I can have multiple casts on one plot. . For standard temp, salinity, etc, I can set the x axis limits using Tlim, Slim. When i choose the fluorescence, the x axis limits go to default of the data range. This wouldn't be so bad if i was plotting one cast, but because I'm plotting multiple casts, I will need to set the xlim to accommodate the full range of all casts. I've been using the following to set up the custom plot
plot(ctd.object, which="Fluorescence", Flim=c(0,10), plim=c(10,0), type="n")
This produces the correct axis and axis labels, but it doesn't like the 'Flim' obviously.
Any ideas? work arounds?
Thanks, Paul