plotly / plotly/plotly.R

Make ggplotly respect override.aes in guide_legend

Open
#989 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ggplotly
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

A short example:

library(ggplot2)
p <- ggplot(economics_long, aes(date, value01, colour = variable)) +
  geom_line(size = .5) + 
  guides(colour = guide_legend(override.aes = list(size = 2)))
p

Notice the thicker lines in the legend on the right

image

However, this new element is ignored in ggplotly:

ggplotly(p)

image

This becomes even more critical when using a very low level of alpha, and then needing to adjust it for the legend.

Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the R example with ggplot2 and ggplotly(p), comparing the ggplot2 and interactive legend results. Trace the ggplotly legend conversion entry point and verify that guide_legend's override.aes values, including size and alpha, affect the rendered legend.

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
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.