[tlocoh-info] Custom colors ramp; error msg

Andy Lyons lyons.andy at gmail.com
Wed Oct 15 08:12:44 CEST 2014

Hi Richard,

Thanks for your good questions, see replies below:

On 10/13/2014 11:55 AM, richard.baxter at ieu.uzh.ch wrote:
> Dear T-Locoh list,
> Really enjoying using this package at the moment, however, I have some 
> methodological questions:
> 1) First up is, was there any resolution to the thread 'showing 
> duration of visit and visitation rate' 15 Jul 2014? As visualizing
> movement data, UDs or movement paths, is essential for communication.

I don't remember if we finished that discussion, but let me look back at 
that thread and get back to you.

> 2) Related to the first, but hopefully much simpler:
> I'm a fan of the trajectory plots with the differing colours for 
> different times but i was wondering how this could be refined
> to show the movement from start to end...as in, green at the start of 
> the movement path (or first timepoint), red at the last time point 
> with a graduated colour palette in between the points.
> It's possible to do in other packages but working with T-Locoh is much 
> more intuitive for me except for the plotting.
> Is this possible? This would be awesome for migratory animals.

Yes you can change the colors that are used to display locations when 
plotting a locoh-xy object. From the help file for plot.locoh.lxy:

col: A single value or vector of color values. Can also be 'auto' 
(default) in which case the colors saved in the locoh-xy object will be 
used (which are rainbow by default).

If you wanted all the locations to be the same color, you could pass a 
single color value as col. For example:

plot(toni.lxy, col="darkblue")

To use a custom color ramp, you can create a vector of color values 
(same length as the number of points) and pass that as col. To display 
the locations green to red, for example, you could run:

n <- nrow(toni.lxy$pts)
green.to.red <- colorRampPalette(c("#00FF00","#FF0000"))(n)
plot(toni.lxy, col=green.to.red)

Granted that the plotting functions in tlocoh have a lot of options that 
can make them klunky to use. Note however you can easily grab the 
SpatialPointsDataFrame of a locoh-xy object, which is saved in the pts 

x <- toni.lxy$pts

> 3) related to plotting: I'm plotting data for between 31 individuals 
> so when I plot the lxy, the command returns the plots in grid form or 
> a lattice.
> Is it possible to separate the plots for the into individuals plot 
> windows?

Yes, set overlay=TRUE

> 4) Not sure what is wrong with the data or my coding but when looking 
> at my sampling freq, there is also bursts below tau0.2 (See attached) 
> similar to the T-LoCoh tutorial, but when i run the code I get the 
> following error:
> > mal.lxy <- lxy.thin.bursts(mal.lxy, thresh=0.2) No bursts were found for id 
> MIDC_01 No bursts were found for id MIDCST_02 New No bursts were found 
> for id MIDIN_01 New No bursts were found for id MIDIN_02 No bursts 
> were found for id MLB_01 No bursts were found for id MLB_02 Error in 
> lxy[["pts"]][-idx.remove, ] : error in evaluating the argument 'i' in 
> selecting a method for function '[': Error in -idx.remove : invalid 
> argument to unary operator
> What is wrong?

This sounds like a bug, or an untrapped error. Let me send you some 
suggestions in a separate message.

> Any help would be most appreciated as I'm due to give a presentation 
> about this for our R-lunch course!
> Best,
> Rich
> _______________________________________________
> Tlocoh-info mailing list
> Tlocoh-info at lists.r-forge.r-project.org
> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tlocoh-info

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/tlocoh-info/attachments/20141014/5b8aa95a/attachment.html>

More information about the Tlocoh-info mailing list