Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual palette colours #325

Merged
merged 5 commits into from
Feb 25, 2025
Merged

Manual palette colours #325

merged 5 commits into from
Feb 25, 2025

Conversation

grantmcdermott
Copy link
Owner

Fixes #324

library(tinyplot)
pkgload::load_all("~/Documents/Projects/tinyplot/")
#> ℹ Loading tinyplot
library(palmerpenguins)

tinytheme("clean2", palette.qualitative = c("darkorange", "purple", "cyan4"))

plt(
  bill_depth_mm ~ bill_length_mm | species, penguins,
  pch = "by",
  alpha = 0.8
)

tinytheme("clean2")
plt(
  bill_depth_mm ~ bill_length_mm | species, penguins,
  pch = "by",
  alpha = 0.8,
  palette = c("darkorange", "purple", "cyan4")
)

Colors are recycled with a warning if too few are provided.

plt(
  bill_depth_mm ~ bill_length_mm | species, penguins,
  pch = "by",
  alpha = 0.8,
  palette = c("darkorange", "purple")
)
#> Warning in by_col(ngrps = ngrps, col = col, palette = palette, gradient = by_continuous, : 
#> Fewer colours (2) provided than than there are groups (3). Recycling to make up the shortfall.

Gradient colors are interpolated.

plt(
  bill_depth_mm ~ bill_length_mm | body_mass_g, penguins,
  pch = "by",
  alpha = 0.8,
  palette = c("darkcyan", "white", "purple")
)

Created on 2025-02-24 with reprex v2.1.1

@grantmcdermott grantmcdermott merged commit 1ba0b03 into main Feb 25, 2025
3 checks passed
@grantmcdermott grantmcdermott deleted the palette_cols branch February 28, 2025 04:34
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.

Pass manual colors to palette
1 participant