This issue is a cross-post from Stack Overflow here. I haven't received any responses in over a week, so I'm hoping that someone from the RStudio Community may have some insights.
I'm creating a project where I'm hoping to embed an interactive histogram into an html page generated from an R Markdown document. Because of the costs associated with the number of interactive histograms and the potential volume of usage, Shiny is not a feasible approach for this project, so I'm attempting to embed an html widget for an interactive histogram that can be filtered using Crosstalk and Plotly. So far, I've been able to create a filterable histogram when using the group argument in ggplot(aes()) (reprex included below). Ultimately, I would like to use multiple variables to filter the histogram, which would cause problems if I'm using the group argument.
Is there a way that I can filter histograms using Crosstalk and Plotly without using the group argument?
Thanks @nirgrahamuk! That does resolve the issue of having two variables in the group argument.
I do have two follow-up questions. When using the group argument, horizontal bars are plotted to delineate the groups within the histogram bars. Is it possible to plot the graphs without those lines. I've included a picture to highlight which bars I'm referring to.
Choosing which values to filter can cause some of the histogram bars to "float." I've included another picture below for reference. Is it possible to "re-center" these bars to the x-axis when filtering so that the graph looks more like a traditional histogram?
the documentation for crosstalk says Crosstalk currently only works for linked brushing and filtering of views that show individual data points, not aggregate or summary views (where “observations” is defined as a single row in a data frame). For example, histograms are not supported since each bar represents multiple data points; but scatter plot points each represent a single data point, so they are supported.
So I'm not surprised that there's undesirable behaviour given the un-catered for use case