-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix color/fill defaults and behavior #91
Conversation
… update vignettes to use fill instead of color
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.
Hi @willgearty, thanks for getting this together! I've made a few comments and potentially caught some unexpected behaviour... let me know your thoughts!
L.
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.
Shouldn't this legend have a cat and a walrus?
@@ -171,13 +171,12 @@ The `rotate_phylopic()` function can be used to rotate a silhouette an arbitrary | |||
img_rot <- rotate_phylopic(img = img, angle = 45) | |||
``` | |||
|
|||
Finally, the `recolor_phylopic()` function can be used to modify the color and/or transparency of a silhouette. The vast majority of PhyloPic silhouettes are black and fully opaque by default. However, it may be useful to change this when the you are trying to either match an existing visualization color palette or trying to convey extra information, such as categorical data, through color. | |||
Finally, the `recolor_phylopic()` function can be used to modify the fill color, outline color, and/or transparency of a silhouette. The vast majority of PhyloPic silhouettes are solid black, are fully opaque, and have a transparent outline by default. However, it may be useful to change this when the you are trying to either match an existing visualization color palette or trying to convey extra information, such as categorical data, through color. |
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.
Finally, the `recolor_phylopic()` function can be used to modify the fill color, outline color, and/or transparency of a silhouette. The vast majority of PhyloPic silhouettes are solid black, are fully opaque, and have a transparent outline by default. However, it may be useful to change this when the you are trying to either match an existing visualization color palette or trying to convey extra information, such as categorical data, through color. | |
Finally, the `recolor_phylopic()` function can be used to modify the fill color, outline color, and/or transparency of a silhouette. The vast majority of PhyloPic silhouettes are solid black, are fully opaque, and have a transparent outline by default. However, it may be useful to change this when the you are trying to either match an existing visualization color palette or trying to convey extra information, such as categorical data, through color. |
Transparent outline or lack of outline?
#' horizontal = hor, vertical = ver) | ||
#' p + ggtitle("R Cat Herd!!") | ||
add_phylopic <- function(img = NULL, name = NULL, uuid = NULL, filter = NULL, | ||
x, y, ysize = Inf, | ||
alpha = 1, color = "black", fill = NA, | ||
alpha = 1, color = NA, fill = "black", |
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.
This doesn't seem to be consistent with add_phylopic_base
?
#' transparency (outline and fill) of the silhouettes, respectively. If | ||
#' `color` is specified and `fill` is NA the outline and fill color will be | ||
#' the same. If "original" is specified for the `color` aesthetic, the | ||
#' The `color` (default: NA), `fill` (default: "black"), and `alpha` ( |
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 am not sure this is working as expected, e.g.
library(ggplot2)
df <- data.frame(x = c(2, 4), y = c(10, 20),
name = c("Felis silvestris catus", "Odobenus rosmarus"))
ggplot(df) +
geom_phylopic(aes(x = x, y = y, name = name), color = NA, size = 10) +
facet_wrap(~name) +
coord_cartesian(xlim = c(1,6), ylim = c(5, 30))
#' The `color` (default: NA), `fill` (default: "black"), and `alpha` ( | ||
#' default: 1) aesthetics can be used to change the outline color, fill color, | ||
#' and transparency (outline and fill) of the silhouettes, respectively. If | ||
#' `color` is specified and `fill` is NA `color` will be used as the fill |
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.
Again, I am not sure this is behaving as expected:
library(ggplot2)
df <- data.frame(x = c(2, 4), y = c(10, 20),
name = c("Felis silvestris catus", "Odobenus rosmarus"))
ggplot(df) +
geom_phylopic(aes(x = x, y = y, name = name), fill = NA, color = "blue", size = 10) +
facet_wrap(~name) +
coord_cartesian(xlim = c(1,6), ylim = c(5, 30))
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.
All looks good now, thanks @willgearty!
This fixes the behavior of the
color
andfill
arguments/aesthetics such that full backwards compatibility is now maintained (no more unnecessary outlines). I've also changed the defaults of these arguments and updated the examples and vignettes to better encourage folks to usefill
instead ofcolor
moving forward.TLDR: no more chubby penguins
Fixes #87.