diff --git a/R/geom-point.R b/R/geom-point.R index 3efa394c31..bf73cf8749 100644 --- a/R/geom-point.R +++ b/R/geom-point.R @@ -85,6 +85,13 @@ #' ggplot(mtcars, aes(wt, mpg)) + #' geom_point(shape = 21, colour = "black", fill = "white", size = 5, stroke = 5) #' +#' # The default shape in legends is not filled, but you can override the shape +#' # in the guide to reflect the fill in the legend +#' ggplot(mtcars, aes(wt, mpg, fill = factor(carb), shape = factor(cyl))) + +#' geom_point(size = 5, stroke = 1) + +#' scale_shape_manual(values = 21:25) + +#' scale_fill_ordinal(guide = guide_legend(override.aes = list(shape = 21))) +#' #' \donttest{ #' # You can create interesting shapes by layering multiple points of #' # different sizes diff --git a/man/geom_point.Rd b/man/geom_point.Rd index 56264c0a36..ccf615e007 100644 --- a/man/geom_point.Rd +++ b/man/geom_point.Rd @@ -182,6 +182,13 @@ d + geom_point(alpha = 1/100) ggplot(mtcars, aes(wt, mpg)) + geom_point(shape = 21, colour = "black", fill = "white", size = 5, stroke = 5) +# The default shape in legends is not filled, but you can override the shape +# in the guide to reflect the fill in the legend +ggplot(mtcars, aes(wt, mpg, fill = factor(carb), shape = factor(cyl))) + + geom_point(size = 5, stroke = 1) + + scale_shape_manual(values = 21:25) + + scale_fill_ordinal(guide = guide_legend(override.aes = list(shape = 21))) + \donttest{ # You can create interesting shapes by layering multiple points of # different sizes diff --git a/vignettes/ggplot2-specs.Rmd b/vignettes/ggplot2-specs.Rmd index 79c6f29d01..21d90e12af 100644 --- a/vignettes/ggplot2-specs.Rmd +++ b/vignettes/ggplot2-specs.Rmd @@ -251,6 +251,8 @@ ggplot(sizes, aes(size, stroke, size = size, stroke = stroke)) + scale_size_identity() ``` +Because points are not typically filled, you may need to change some default settings when using these shapes and mapping `fill`. In particular, discrete `fill` guides will be drawn with an unfilled shape unless overridden (refer to `geom_point()` for an example of this). + ## Text ### Font family