Skip to content
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

AsIs aesthetics #1518

Closed
schloerke opened this issue Jan 25, 2016 · 2 comments
Closed

AsIs aesthetics #1518

schloerke opened this issue Jan 25, 2016 · 2 comments
Labels
feature a feature request or enhancement
Milestone

Comments

@schloerke
Copy link
Contributor

I'm trying to use aesthetics with the AsIs function to use values as they are.

library(ggplot2)

ggplot(data = iris, aes(Sepal.Length, Sepal.Width)) + geom_point(aes(size = I(5)))
# Error in data.frame(size = 5, PANEL = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  : 
  arguments imply differing number of rows: 1, 150
# thought process... produces error.  ok, I can make it longer.  trying again.
ggplot(data = iris, aes(Sepal.Length, Sepal.Width)) + geom_point(aes(size = I(rep(5, nrow(iris)))))

screenshot 2016-01-25 14 20 15

This produces a plot that is treated as a true value, rather than AsIs.

How can I make something a 'parameter' through the use of aes()?

  • Barret
@hadley
Copy link
Member

hadley commented Jan 25, 2016

You can't, unless you use ggvis.

You have to either move it outside of the aes() or use scale_size_identity()

@hadley hadley closed this as completed Jan 25, 2016
hadley added a commit that referenced this issue Jan 25, 2016
@hadley
Copy link
Member

hadley commented Jan 25, 2016

Oh hmm, I made it work because it turned out to be easy

@hadley hadley added the feature a feature request or enhancement label Jan 25, 2016
@hadley hadley added this to the v2.1.0 milestone Jan 25, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants