Skip to content

Plotly does not work with geom_chicklet #2431

Open
@Jody-O

Description

@Jody-O

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions