Closed sda030 closed 10 months ago
If you need interactivity, why not using Plotly? you can pass directly the result of gglikert()
to plotly::ggplotly()
to get an interactive graph.
Note: you can use gglikert_data()
to process the data and get a tibble ready to be used with your own graph, using geom_bar()
with stat_likert()
.
I do not know if geom_bar_interactive()
is compatible with other stat functions
If you need interactivity, why not using Plotly? you can pass directly the result of
gglikert()
toplotly::ggplotly()
to get an interactive graph.
I found Plotly quick and neat, but ggplotly a bit limited in specifying the onClick, hover, etc attributes. I could not figure out how to explicitly configure a count variable to be displayed on hover. Also, Plotly is perhaps not as pretty as ggplot/ggiraph/ggstats, but that is my opinion.
Note: you can use
gglikert_data()
to process the data and get a tibble ready to be used with your own graph, usinggeom_bar()
withstat_likert()
.
stat_likert()? Where do I find this?
P.S. Going on holiday soon so I will likely not be able to try this out for a couple of weeks.
Sorry. I meant position_likert()
https://larmarange.github.io/ggstats/reference/position_likert.html
Dear @larmarange, your gglikert and gglikert_stacked are exactly the ready-made solutions for what I have been to a large extent implementing manually. However, I would also need some ggiraph interactivity added. Would you happen to know of a way for me to use ggstats as the foundation, and then add ggiraph on top? This is for a new package in development so if there is some dirty hack that I could hide within a wrapper function, it would be ok. Though I guess it would require replacing many of the ggplot2 geoms, scales, etc with the corresponding ones from ggiraph. The specific part that I need is that hovering over a category (a cell) highlights the count. Perhaps also more info such as showing the variable name when clicking on the variable label, etc.
I expect you not wanting to pull in another dependency such as ggiraph. Would however a conditional check of whether ggiraph is installed, and a new default argument
interactive = FALSE
be something to consider, if the wrapper approach seems tricky?Best