ggplotly does not respect the labels argument in ggplot2:scale_fill_manual
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
ggplotly does not respect the labels argument in ggplot2:scale_fill_manual.
library(tidyverse)
plot_data <- ggplot2::diamonds %>%
mutate(cut = stringr::str_to_sentence(cut)) %>%
group_by(cut, clarity) %>%
summarise(average_price = mean(price)) %>%
mutate(average_price = round(average_price / 1000, 1)) %>%
ungroup()
plot <- ggplot(data = plot_data, aes(average_price, cut, fill = clarity)) +
geom_col() +
coord_flip() +
scale_fill_manual(values = viridis::viridis(8), labels = LETTERS[1:8])
plot
plotly::ggplotly(plot)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied R example with ggplotly and compare its legend labels with the ggplot2 plot. Trace the ggplotly conversion entry point for scale_fill_manual and verify how the labels argument is handled; done means the converted plot displays LETTERS[1:8] as the fill labels.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100