forestgeo / Climate

Climate data for ForestGEO sites
https://forestgeo.github.io/Climate/
Creative Commons Attribution 4.0 International
7 stars 9 forks source link

My first issue! Review viz tool #6

Closed biancaglez closed 4 years ago

biancaglez commented 4 years ago

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

teixeirak commented 4 years ago

@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.

biancaglez commented 4 years ago

@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!

teixeirak commented 4 years ago

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?

rudeboybert commented 4 years ago

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

rudeboybert commented 4 years ago

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:

rudeboybert commented 4 years ago

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() 

Rplot02 Then hitting that plot with a ggplotly() you can really see that PET peaks during spring:

Screen Shot 2020-06-02 at 11 12 02 AM

Nice job otherwise @biancaglez!

biancaglez commented 4 years ago

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?)

rudeboybert commented 4 years ago

Ah yes, I forgot that you can zoom-in to plots! That would make the code much simpler. good point.

biancaglez commented 4 years ago

All up to date with everyone's suggestions!

biancaglez commented 4 years ago

image

It might be the visualization that is off, but @teixeirak did you mean that these values shouldnt' be 0 for FRS?

teixeirak commented 4 years ago

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

teixeirak commented 4 years ago

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.

biancaglez commented 4 years ago

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.

biancaglez commented 4 years ago

image

I couldn't find the script with Valentine's month code so I wrote some new code and made the month by month graphs. All pushed to github.... I am still thinking best course of action is to consolidate both scripts.

png of interactive plot

image

teixeirak commented 4 years ago

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.

biancaglez commented 4 years ago

Sweet, I think I will leave them separate for now, and if I have some extra time will consolidate! Closing for now