Repository navigation
Conversation
|
I personally against adding library(ggplot2)
d <- data.frame(x = 1:3)
ggplot(d, aes(x, size = 3^x)) +
geom_point(aes(y = "circle"), shape = "circle") +
geom_point(aes(y = "."), shape = ".")Created on 2023-02-21 with reprex v2.0.2 For |
|
Thanks for your thoughts!
I agree it doesn't really play well with the grammar of graphics. However, there currently aren't any prohibitions on specifying
The documentation of Aside from that, you cannot currently mix valid names with NAs (backtraces omitted): ggplot2:::translate_shape_string(c("circle", NA_character_))
#> Error in `ggplot2:::translate_shape_string()`:
#> ! Shape aesthetic contains invalid value: NA
# This following is particularly uninformative
ggplot2:::translate_shape_string(c(NA_character_, "circle"))
#> Error in if (nchar(shape_string[1]) <= 1) {: missing value where TRUE/FALSE neededCreated on 2023-02-21 with reprex v2.0.2 |
|
A bit off-topic, but I think ggplot2 should have prohibited any use of these single characters as a shape. We can use arbitrary letter here, but I feel this isn't a "point" geom anymore. That said, even so, I guess library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
geom_point(shape = "龍", size = 30, alpha = 0.3)Created on 2023-02-22 with reprex v2.0.2
Yeah, that's the point, but I think
is not right. From the users' perspective, library(ggplot2)
d <- data.frame(
id = c("non-missing", "missing"),
shape = c("circle", NA)
)
ggplot(d, aes(id, y = 0L, shape = shape)) +
geom_point(size = 30) +
scale_shape_identity()
#> Warning: Removed 1 rows containing missing values (`geom_point()`).Created on 2023-02-22 with reprex v2.0.2 |
|
I too am against adding "dot"... I think a pixel-sized spot has value but not as part of any scaling etc so I think its main use is when setting shape directly rather than mapping it - and in these instances |
|
Right, but all the arguments made for "dot", also apply to "blank", so I think it'd be better to close this PR then, no? |
|
yeah, I think you can close it |



This PR implements the suggestion in #5088 (comment) to fix #5088.
Briefly, it adds
"dot"and"blank"as valid names for shapes ingeom_point()that get translated toshape = "."andshape = NArespectively. The specs vignette was also updated to reflect this.