Skip to content

Apply ggplot2 theme palettes in ggplotly() - #2509

Open
M-Colley wants to merge 1 commit into
plotly:masterfrom
M-Colley:fix/2505-ggplot-theme-palette
Open

M-Colley wants to merge 1 commit into
plotly:masterfrom
M-Colley:fix/2505-ggplot-theme-palette

Conversation

@M-Colley

@M-Colley M-Colley commented Dec 3, 2026

Copy link
Copy Markdown

Summary

Fixes #2505.

Apply theme palettes before training non-position scales during ggplotly() conversion. Use the palette method when the installed ggplot2 provides it.

Evidence

  • On master, ggplotly() produces the default marker colours for a plot whose theme specifies a custom palette. With this change the marker colours match the theme, and an explicit manual scale still takes precedence.
  • The ggplot conversion tests passed 792 assertions on ggplot2 4.0.3, with the same 11 skips and nine warnings as master.
  • Manual-scale conversion passed on ggplot2 3.5.2.

Prepared with AI assistance. The conversion tests ran locally.

@M-Colley

M-Colley commented Dec 3, 2026

Copy link
Copy Markdown
Author

This addresses #2505. The regression checks that ggplotly() retains the theme palette and that a manual scale still takes precedence. The ggplot conversion suite passed 792 assertions, and manual-scale conversion passed with ggplot2 3.5.2.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ggplotly() does not keep palette.colour.discrete defined in ggplot2::theme()

1 participant