Open swood-ecology opened 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
Are there other aspects other than sample size we would want to highlight in a roll over?
Possibly the number of farms and/or soil types included?
The mean and SE values for the point could be good too
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.
forestplot
to Plotly
num_papers1
, num_comparisons1
, mean_per_change1
, and sem_per_change1
as roll over textlayout
function to try and make the plot look a little closer to the original ggplot
.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
functionPlotly
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 exampleggplot
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!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.
There should be a label on top of/above the forest plot points that indicates the number of observations underlying that point.