Science-for-Nature-and-People / Midwest-Agriculture-Synthesis

Synthesizing and visualizing the impact of conservation agriculture
6 stars 4 forks source link

Label forest plot points dynamically with the number of observations #6

Open swood-ecology opened 5 years ago

swood-ecology commented 5 years ago

There should be a label on top of/above the forest plot points that indicates the number of observations underlying that point.

LesleyAtwood commented 5 years ago

Example of this enhancement and underlying code https://songxh.shinyapps.io/MovieStats/ <- roll over (the embedded drop down user guide is also a cool feature of this app)

    code for above <https://github.com/songxh0424/MovieStats>

For our figure use the following cols to start with: num_papers1 and num_comparisons1

Other similar cols are embedded in the data frame which can be used with refined filtering of the dataset

swood-ecology commented 5 years ago

Are there other aspects other than sample size we would want to highlight in a roll over?

LesleyAtwood commented 5 years ago

Possibly the number of farms and/or soil types included?

LesleyAtwood commented 5 years ago

The mean and SE values for the point could be good too

nathanhwangbo commented 5 years ago

I started playing around with this in the branch "hoverPlot", which has been pushed to the repo.

ggplot itself does not support roll over text, so the idea is to use ggplotly to convert a ggplot to a Plotly plot. However, some of the ggplot aesthetics are not supported in Plotly, so it will take some work to get the plots to look the same.

Done

Issues

swood-ecology commented 5 years ago

I don't think the plots need to look exactly the same as ggplot2, as long as they look nice and work. I'm also not totally wedded to the visualization of n being a roll over function. It could be text that displays on the plot and auto-updates with filtering. That would be pretty easy to do in ggplot2. @LesleyAtwood interested to hear what you think.