Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
swood-ecology opened this issue Feb 6, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@swood-ecology
Copy link
Collaborator

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

@swood-ecology swood-ecology added the enhancement New feature or request label Feb 6, 2019
@LesleyAtwood
Copy link
Contributor

LesleyAtwood commented Feb 19, 2019

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
Copy link
Collaborator Author

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

@LesleyAtwood
Copy link
Contributor

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

@LesleyAtwood
Copy link
Contributor

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

@nathanhwangbo
Copy link
Collaborator

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

  • Converted the forestplot to Plotly
  • Added num_papers1, num_comparisons1, mean_per_change1, and sem_per_change1 as roll over text
  • Played around with the layout function to try and make the plot look a little closer to the original ggplot.

Issues

  • Other than num_papers1, num_comparisons1, I wasn't sure which columns of summary_all to add in the roll over text. We can add them via the text argument in the ggplot function
  • Plotly doesn't accept the scales = "free" argument in facet_grid, so all of the facets will be equally spaced. This is a known issue with ggplotly, but if we really want free scales, we can try rebuilding the plot from the ground up using Plotly. see https://stackoverflow.com/questions/37736103/error-plotting-chart-with-facet-wrap-and-scales-free-in-plotly# for an example
  • There are many aesthetic differences between the ggplot we had and this new interactive plot. I wasn't sure which to tackle. Please take a look at the branch when you have time!

@swood-ecology
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants