-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add vignette for plt_tize() #12
base: main
Are you sure you want to change the base?
Conversation
) | ||
``` | ||
|
||
This vignette demonstrates how to use the {palettizer} package to generate a color palette from an image and apply it to a {ggplot2} plot using the palmerpenguins dataset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should palmerpenguins have curly braces like the other package names? Or no curly braces for any package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a preference? I'll go through and make sure they all match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer no curly braces as per tidyverse style.
The {palettizer} package generates a color palette from an image using K-means clustering. The algorithm works as follows: | ||
|
||
1. The image is first resized to a smaller version for faster processing. | ||
2. The colors of the image are then represented in the LAB color space, which is more perceptually uniform compared to RGB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
```{r generate-palette} | ||
plt_vector <- | ||
palettizer::plt_tize("lter_penguins.png", cluster_count = 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need the palettizer:: since you've already loaded the package, and this can all likely go in a single line.
palettizer::plt_tize("lter_penguins.png", cluster_count = 3) | ||
``` | ||
|
||
## Create a {ggplot2} plot with the generated color palette |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest: Create a plot with the generated color palette.
|
||
## Create a {ggplot2} plot with the generated color palette | ||
|
||
Finally, we will create a {ggplot2} plot using the palmerpenguins dataset and apply the generated color palette: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, ggplot2 plot seems redundant here.
scale_color_manual(values = plt_vector) + | ||
labs( | ||
title = "Flipper and bill length", | ||
subtitle = "Dimensions for Adelie, Chinstrap and Gentoo Penguins at Palmer Station LTER", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest comma after Chinstrap.
flipper_bill | ||
``` | ||
|
||
This creates a {ggplot2} plot with the color palette generated from the image applied to the data points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above.
Closes #11
Add vignette for plt_tize() 🐧