Skip to content

Show a list of shapes in scale_shape docs #1578

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

Merged
merged 3 commits into from
Jul 29, 2016
Merged

Show a list of shapes in scale_shape docs #1578

merged 3 commits into from
Jul 29, 2016

Conversation

steveharoz
Copy link
Contributor

I often wind up hunting for the indices corresponding to different shapes, and it'd be nice if they were in the docs.

#' # Show a list of available shapes
#' df_shapes <- data.frame(shape = factor(0:24))
#' ggplot(df_shapes, aes(shape=shape)) +
#' geom_point(aes(shape=shape, x=0, y=0), size=5, fill="red") +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use spaces around =?

@hadley
Copy link
Member

hadley commented Jul 28, 2016

This is the code I use in the vignette:

    shapes <- data.frame(
      shape = c(0:19, 22, 21, 24, 23, 20),
      x = 0:24 %/% 5,
      y = -(0:24 %% 5)
    )
    ggplot(shapes, aes(x, y)) + 
      geom_point(aes(shape = shape), size = 5, fill = "red") +
      geom_text(aes(label = shape), hjust = 0, nudge_x = 0.15) +
      scale_shape_identity() +
      expand_limits(x = 4.1) +
      scale_x_continuous(NULL, breaks = NULL) + 
      scale_y_continuous(NULL, breaks = NULL)

Probably a bit too complicated to include in an example though

@hadley hadley added the ready label Jul 28, 2016
@hadley hadley added this to the v2.2.0 milestone Jul 29, 2016
@hadley hadley merged commit 52e2e23 into tidyverse:master Jul 29, 2016
@hadley hadley removed the ready label Jul 29, 2016
@hadley
Copy link
Member

hadley commented Jul 29, 2016

I like it! This is more elegant than my approach

@lock
Copy link

lock bot commented Jan 18, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants