My first issue! Review viz tool
biancaglez opened this issue ยท 16 comments
Hi all -- working on my first issue to get the hang of this and also request some feedback. If you're available - pls review visualization script found below.
My main question is, would it be easy for anyone to use these scripts to visualize CRU data? @rudeboybert @teixeirak
See scripts here: https://github.com/forestgeo/Climate/tree/master/scripts
@biancaglez , thanks! I created a folder for these scripts to keep things clear.
I can give you feedback as someone with very limited R skills (as some users will have).
When I tried to run the single site script, I got this error:
"Error in ggplotly(plot_list[[11]]) : could not find function "ggplotly""
I'm not sure if this is user error or something that could be fixed in the script.
@teixeirak - great, thanks! It turned out to be some ggplotly specific syntax that I've now fixed. Did the multi-site script work for you? Thanks for the feedback!
Hmmm... still getting the same problem for both scripts:
Error in ggplotly(plot_list[["Amacayacu CLD"]]) :
could not find function "ggplotly"
perhaps I'm missing a library?
That's a function in the plotly
package loaded on line 13. Did the package load for you?
ICYMI plotly::ggplotly()
takes ggplots and makes them interactive based on the variable mappings you define in aes
My only comment @biancaglez is that using a scatterplot makes it hard to make sense of the densely clustered points. To see what I mean:
ggplot(df_long, aes_string(x="Date", y=df$clim)) +
geom_point()
You'll get:
However, if you make this into a linegraph instead of a scatterplot using this code:
ggplot(df_long, aes_string(x="Date", y=df$clim)) +
geom_line()
Also note that because we have A LOT of years, the seasonality is ultra compressed. If you zoom in on the last 20 years for example, it's really easier to spot:
ggplot(df_long, aes_string(x="Date", y=df$clim)) +
coord_cartesian(xlim = c(as.Date("2000-01-01"), NA)) +
geom_line()
Then hitting that plot with a ggplotly()
you can really see that PET peaks during spring:
Nice job otherwise @biancaglez!
Thank you for the feedback @rudeboybert . What do you think @teixeirak?
For me, when looking at the two above plots, I would more easily connect the dots in my brain and be able to see where the data is filled in by the mean with a scatterplot. I think it depends on the use of the plots. IE looking at seasonality versus looking at where it is filled in by mean. I can also add both plots and depending on the use of the viz tool, people can comment/uncomment the different line/point plots.
& I can add code with xlims too (I was hoping the interactive plot would help people zoom in on the years they're interested in and hence easier for people with no experience - what do you think Krista? Would you as a user with more limited experience prefer an interactive or date limits on your plot that you can manually change?)
Ah yes, I forgot that you can zoom-in to plots! That would make the code much simpler. good point.
All up to date with everyone's suggestions!
It might be the visualization that is off, but @teixeirak did you mean that these values shouldnt' be 0 for FRS?
That's working; thanks! I do have a couple suggestions for how it could be improved:
1- I think we really only need one script where you could list one or more sites, maybe with the option to automatically do all. I don't think many users will want to run all sites at once.
2- It would be helpful to visualize by month. I'm annoyed at myself for forgetting this earlier-- @ValentineHerr made a script to visualize CRU by month for this project. Plots are here
It might be the visualization that is off, but @teixeirak did you mean that these values shouldnt' be 0 for FRS?
It should be 0. FRS is number of frost days, which should always be zero for tropical sites. So the plot is correct.
Great, thank you.
1- Do you think that the single site script, where the index of the site can be changed to produce plots for the site of interest fits this goal? I can also add the multi-sites code to the bottom of the single site script and we can call it the visualization script to simplify.
Another option, which will require some more time, is to make an app where people can interactively choose the site they want to visualize (IE a drop-down menu bar on a website). We made some Rshiny apps with @rudeboybert in an intro to DS and I think I could find a way to make this work (depends on how much time we want to allocate to this viz project)
2- I will add the code Valentine has for the month by month vis.
This is fantastic, thank you @biancaglez !
If combining the two scripts is complicated, don't worry about it. It's something that could be nice/convenient, but not critical, so not something we'd want to invest a ton of time on.
Sweet, I think I will leave them separate for now, and if I have some extra time will consolidate! Closing for now