plotly.R icon indicating copy to clipboard operation
plotly.R copied to clipboard

Plotly does not work with geom_chicklet

Open Jody-O opened this issue 10 months ago • 1 comments

I make a lot of bar charts and prefer geom_chicklet over goem_col for presentations

library(ggplot2) library(plotly) library(scales)

p <- ggplot(aes(y = perc, x = response, fill = fill_color, text = paste("Response:", response, "
Percent:", percent(perc)))) + # Tooltip content geom_chicklet() + coord_flip() + scale_fill_identity() + scale_y_continuous(labels = percent_format()) + labs(title = "Barriers indicated by the survey: these are the reasons people say they don't vote", y = paste("Percent of the", nrow(combined_surveys_english), "survey respondents"), caption = "", x = "") + theme_colibri() + theme(axis.text.y = element_text(color = "black", size = 10), strip.text.y = element_text(angle = 0), plot.title = element_text(size = 16), legend.position = "none")

Convert to interactive plot

ggplotly(p, tooltip = "text")

Jody-O avatar Mar 05 '25 20:03 Jody-O

Those plots look great!

I think this could possibly be somewhat mimicked using barcornerradius in plotly.js, would need to investigate.

romanzenka avatar Mar 07 '25 16:03 romanzenka