ctmm-initiative / ctmm

Continuous-Time Movement Modeling. Functions for identifying, fitting, and applying continuous-space, continuous-time stochastic movement models to animal tracking data.
http://biology.umd.edu/movement.html
43 stars 10 forks source link

How to plot SVF for different individuals with the same time unit (days, months, ...)? #25

Closed bniebuhr closed 5 years ago

bniebuhr commented 5 years ago

Dear all,

I am using ctmm to understand range dynamics of several individuals in the same area. However, some individuals were monitored for only some days, while others were monitored for several months. I am plotting semivariograms for all of them in a single figure, but I would like to keep the same time scale (the unit of time indeed) for all individuals (i.e., days or months). I don't want all the x axes with the same extent (in this case I believe I could just use xlim as the same for all the plots), but all of the plots with the same time unit.

Is there a way I can set that?

(Just to make ir clearer, if I choose "months" and my time unit, I would like to see the x axis of the SVF plot ranging from 0 to 0.5 for an individual that was monitored for 15 days.)

chfleming commented 5 years ago

Turning the unit conversion off (to SI units) would be easy. To fix the units, I will have to think about how to code that best.

bniebuhr commented 5 years ago

Hi, Chris,

I think turning off the unit conversion would do. I tried to explore it a little to see if I can do it locally, but it seems to me that this is not done within the variogram function, maybe within plot.telemetry. But as we call it only as plot() and plot.telemetry does not exist by itself (at least I am not sure how to make reference to this function), I don't know how to access the function to try to change it myself.

xhdong-umd commented 5 years ago

Actually making all x and y to have same extent will make sure all plots to have same unit, and the plots will be easier to compare side by side.

You can have a look at our previous discussions on the webapp, which will draw a group of variograms in same unit and extent if in absolute zoom mode. Especially the discussion about extent. You can also look at the code here for examples of how to do that. You can even just use the plot_vario function in ctmmweb.

Basically extent will calculate a range to cover all individuals, and setting all plot to this range make sure they have same unit and axis extent.

chfleming commented 5 years ago

The units=FALSE option is in. The function to fiddle with for unit conversion/selection is unit() in units.R.

bniebuhr commented 5 years ago

@chfleming thanks for promptly including this option. How should I do to access this last version of the function?

@xhdong-umd thanks for the links on your discussion about that, it was very helpful. I agree that keeping the extent fixed for all individuals is a good practice, however, it is hard to visualize the SVF for some individuals when the monitoring time is very different for different individuals (e.g., one individual monitored for two months and another for 18 months). This is why I suggested adding flexibility to that.

chfleming commented 5 years ago

devtools::install_github("ctmm-initiative/ctmm")

bniebuhr commented 5 years ago

devtools::install_github("ctmm-initiative/ctmm")

Great, thanks!