[R] Plotting multiple trends on one graph

John Kane jrkrideau at inbox.com
Mon Nov 25 15:24:06 CET 2013


I am not sure I have grasped what you want but have a look at this using  ggplot2 with Duncan's modified data set (with his factor and striptime commands executed)

You will probably need to install ggplot2 :
install.packages("ggplot2) 


library(ggplot2)
ggplot(dat, aes(gspd_mps, Station )) + geom_point() +
  facet_grid(TagID ~ .)

John Kane
Kingston ON Canada


> -----Original Message-----
> From: nhoughton01 at gmail.com
> Sent: Sun, 24 Nov 2013 08:49:03 -0800
> To: r-help at r-project.org
> Subject: [R] Plotting multiple trends on one graph
> 
>> 
>> Hello all,
>> 
>> I am tracking hundreds of animals through a system with multiple timing
>> points.  I want to graph the movement of individuals through the whole
>> array on one graph, but I can't figure out how to do that.  An example
>> of
>> my data is below.  Basically for each 'TagID', I want to graph the
>> 'date'
>> or 'gspd_mps' on the X axis and 'Station' on the Y axis, with all
>> TagID's
>> on one graph.
>> 
> 
> Thanks for the help!!  I'm very new to R.
> Natalie
> 
>    TagID Station datetime gspd_mps  4926 KLB 12/21/2012 1:52 NA  4926
> MS01 12/21/2012
> 2:38 0.851  4926 MS02 12/21/2012 3:48 0.629  4926 MS03 12/21/2012 4:19
> 0.86
> 4926 MS04 12/21/2012 4:34 1.131  4926 MS05 12/21/2012 5:01 0.9  4926
> MS06 12/21/2012
> 6:54 0.798  4926 MS07 12/21/2012 7:21 0.853  4926 MS08 12/21/2012 10:23
> 0.694  4926 MS09 12/21/2012 12:16 0.6  4926 MS10 12/21/2012 14:38 0.647
> 4929 KLB 12/21/2012 1:08 NA  4929 MS01 12/21/2012 2:12 0.611  4929
> MS02 12/21/2012
> 3:33 0.563  4929 MS03 12/21/2012 3:59 1.04  4929 MS04 12/21/2012 4:13
> 1.082
> 4929 MS05 12/21/2012 5:00 0.475  4929 MS06 12/21/2012 6:52 0.796  4929
> MS07 12/21/2012
> 7:32 0.563  4929 MS08 12/21/2012 10:16 0.809  4929 MS09 12/21/2012 11:43
> 0.783  4929 MS10 12/21/2012 14:02 0.657  4929 MS11 12/22/2012 2:50 0.326
> 4929 MS12 12/22/2012 5:04 0.709  4929 MS13 12/22/2012 13:59 0.688
>> 
>> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!



More information about the R-help mailing list