[R] ggridges help

Roy Mendelssohn - NOAA Federal roy.mendelssohn at noaa.gov
Tue Oct 17 21:22:38 CEST 2017


Hi All:

I am just not understanding ggridges.  The data I have are time series at different depths in the ocean.  I want to make a joy plot of the time series by depth.

If I was just doing a ggplot2 line plot I would be doing:

ggplot(plotFrame, aes(x = time, y = cycle, group = depth)) + geom_line()

but translating that to ggridges has not worked right.  Below is the result from dput() of a simplified data frame that has 3 depths and 2 years of monthly data.  (In fact I have  20 depths and 30  years of monthly data).   The command above will work with this data frame.

Thanks for any help.

-Roy

>dput(plotFrame)
structure(list(time = structure(c(719236800, 721915200, 724507200, 
727185600, 729777600, 732283200, 734961600, 737553600, 740232000, 
742824000, 745502400, 748180800, 750772800, 753451200, 756043200, 
758721600, 761313600, 763819200, 766497600, 769089600, 771768000, 
774360000, 777038400, 779716800, 719236800, 721915200, 724507200, 
727185600, 729777600, 732283200, 734961600, 737553600, 740232000, 
742824000, 745502400, 748180800, 750772800, 753451200, 756043200, 
758721600, 761313600, 763819200, 766497600, 769089600, 771768000, 
774360000, 777038400, 779716800, 719236800, 721915200, 724507200, 
727185600, 729777600, 732283200, 734961600, 737553600, 740232000, 
742824000, 745502400, 748180800, 750772800, 753451200, 756043200, 
758721600, 761313600, 763819200, 766497600, 769089600, 771768000, 
774360000, 777038400, 779716800), class = c("POSIXct", "POSIXt"
), tzone = "UTC"), depth = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L), .Label = c("20", "40", "60"), class = "factor"), cycle = structure(c(-0.164397110685046, 
-0.0639063592004652, -0.124275650584243, 0.232340199700421, 0.23265929828899, 
0.452800479990173, 0.631515844862171, 0.708775442811806, 0.402797787246307, 
0.540279471159411, 0.625583653374072, 0.607609707505232, 0.789645459141814, 
0.57943178332249, 0.395406041578379, 0.278792362706845, 0.000158405680203533, 
0.0618374997078718, 0.0942838757427736, 0.046510899158667, 0.136800366664298, 
0.165118554160811, 0.228812312665972, -0.225383761996565, -0.204115732057999, 
-0.0883683879679482, -0.135111844938738, 0.147562070872115, 0.198086355354394, 
0.386803300687593, 0.684023051288189, 0.69669009829253, 0.381213154479, 
0.550118050327324, 0.641294267691433, 0.614909878956221, 0.772779409518665, 
0.581967160929841, 0.381662488154885, 0.293380662335543, 0.0391733417449068, 
-0.0844674860904995, 0.163695040677223, 0.0444585016269223, 0.130561029192561, 
0.180784990884611, 0.242929491090375, -0.126543843540014, -0.112781525045155, 
-0.1803388763034, -0.0939120153437669, 0.150968491445835, 0.0992298571202001, 
0.289294645512006, 0.540517483378127, 0.625091194385051, 0.432224338078479, 
0.504654513110009, 0.62584673393424, 0.56834612321311, 0.789331138620147, 
0.6389908671341, 0.45156693996368, 0.412578785088203, 0.212440848202924, 
0.146392303930216, 0.654494252844301, 0.470248736982212, 0.239891529116349, 
0.200137949677769, 0.2858429346658, -0.121094155739595), .Dim = 72L)), .Names = c("time", 
"depth", "cycle"), row.names = c(NA, -72L), class = "data.frame")

**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.



More information about the R-help mailing list