Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Improvements for documentation of shapes #717

Closed
wants to merge 4 commits into from

2 participants

@BrianDiggs

I've made a few improvements to the examples showing different shapes. I've submitted this at two separate commits within the same pull request. The first fixes errors in the documentation: there are 26 (0-25) shapes and shapes 19 and 20 do not have a fill. The second presents a better version of the shape catalog.

The first should be applied as it corrects factual errors; the second is optional, but I think a significant improvement.

BrianDiggs added some commits
@BrianDiggs BrianDiggs Fix errors in shape documentation
There are 26, not 25 shapes (shape 0 was not shown). Only symbols 21
through 25 have a fill option; 19 and 20 do not.
bff7613
@BrianDiggs BrianDiggs Improved graphic for shapes catalog
Revamped the graphic for showing the different shapes (0-25) utilizing
facet_wrap instead of staggering along the axes. Also using theme to
get rid of unnecessary elements, but retainging the grid lines that show
exactly where the points are centered. Changed the fill from black to
lightblue and made the symbols bigger.
f558ee0
R/aes-linetype-size-shape.r
((21 lines not shown))
#' # background colour (fill)
-#' s + geom_point(aes(shape = z), size = 4, colour = "Red") +
+#' s + geom_point(aes(shape = z), size = 10, colour = "Red") +
@hadley Owner
hadley added a note

This would be slightly cleaner if you put scale_shape_identity in the specification of s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@BrianDiggs

Merged this into a different branch that is a bigger overhaul of aesthetic documentation, so this pull request is no longer needed/relevant.

@BrianDiggs BrianDiggs closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 6, 2012
  1. @BrianDiggs

    Fix errors in shape documentation

    BrianDiggs authored
    There are 26, not 25 shapes (shape 0 was not shown). Only symbols 21
    through 25 have a fill option; 19 and 20 do not.
  2. @BrianDiggs

    Improved graphic for shapes catalog

    BrianDiggs authored
    Revamped the graphic for showing the different shapes (0-25) utilizing
    facet_wrap instead of staggering along the axes. Also using theme to
    get rid of unnecessary elements, but retainging the grid lines that show
    exactly where the points are centered. Changed the fill from black to
    lightblue and made the symbols bigger.
Commits on Nov 8, 2012
  1. @BrianDiggs
Commits on Nov 19, 2012
  1. @BrianDiggs
This page is out of date. Refresh to see the latest.
Showing with 30 additions and 18 deletions.
  1. +15 −9 R/aes-linetype-size-shape.r
  2. +15 −9 man/aes_linetype_size_shape.Rd
View
24 R/aes-linetype-size-shape.r
@@ -55,14 +55,20 @@
#' # Shape can also be mapped from a variable
#' p + geom_point(aes(shape = factor(cyl)))
#'
-#' # A look at all 25 symbols
-#' df2 <- data.frame(x = 1:5 , y = 1:25, z = 1:25)
-#' s <- ggplot(df2, aes(x = x, y = y))
-#' s + geom_point(aes(shape = z), size = 4) + scale_shape_identity()
-#' # While all symbols have a foreground colour, symbols 19-25 also take a
+#' # A look at all 26 symbols
+#' df2 <- data.frame(x = 1, y = 1, z = 0:25)
+#' s <- ggplot(df2, aes(x = x, y = y)) +
+#' scale_x_continuous(breaks=c(1)) +
+#' scale_y_continuous(breaks=c(1)) +
+#' scale_shape_identity() +
+#' facet_wrap(~z) +
+#' theme_bw() +
+#' theme(axis.text = element_blank(),
+#' axis.title = element_blank(),
+#' axis.ticks = element_blank())
+#' s + geom_point(aes(shape = z), size = 10)
+#' # While all symbols have a foreground colour, symbols 21-25 also take a
#' # background colour (fill)
-#' s + geom_point(aes(shape = z), size = 4, colour = "Red") +
-#' scale_shape_identity()
-#' s + geom_point(aes(shape = z), size = 4, colour = "Red", fill = "Black") +
-#' scale_shape_identity()
+#' s + geom_point(aes(shape = z), size = 10, colour = "Red")
+#' s + geom_point(aes(shape = z), size = 10, colour = "Red", fill = "lightblue")
NULL
View
24 man/aes_linetype_size_shape.Rd
@@ -56,15 +56,21 @@ p + geom_point(shape = NA)
# Shape can also be mapped from a variable
p + geom_point(aes(shape = factor(cyl)))
-# A look at all 25 symbols
-df2 <- data.frame(x = 1:5 , y = 1:25, z = 1:25)
-s <- ggplot(df2, aes(x = x, y = y))
-s + geom_point(aes(shape = z), size = 4) + scale_shape_identity()
-# While all symbols have a foreground colour, symbols 19-25 also take a
+# A look at all 26 symbols
+df2 <- data.frame(x = 1, y = 1, z = 0:25)
+s <- ggplot(df2, aes(x = x, y = y)) +
+ scale_x_continuous(breaks=c(1)) +
+ scale_y_continuous(breaks=c(1)) +
+ scale_shape_identity() +
+ facet_wrap(~z) +
+ theme_bw() +
+ theme(axis.text = element_blank(),
+ axis.title = element_blank(),
+ axis.ticks = element_blank())
+s + geom_point(aes(shape = z), size = 10)
+# While all symbols have a foreground colour, symbols 21-25 also take a
# background colour (fill)
-s + geom_point(aes(shape = z), size = 4, colour = "Red") +
- scale_shape_identity()
-s + geom_point(aes(shape = z), size = 4, colour = "Red", fill = "Black") +
- scale_shape_identity()
+s + geom_point(aes(shape = z), size = 10, colour = "Red")
+s + geom_point(aes(shape = z), size = 10, colour = "Red", fill = "lightblue")
}
Something went wrong with that request. Please try again.