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

legend should respect layer data subset #5

Closed
hadley opened this issue Dec 2, 2009 · 6 comments
Closed

legend should respect layer data subset #5

hadley opened this issue Dec 2, 2009 · 6 comments
Assignees
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@hadley
Copy link
Member

hadley commented Dec 2, 2009

In this example, points and lines are used for both values.

df.actual <- data.frame(x = 1:10, y = 1:10)
df.approx <- data.frame(x = 1:15, y = 1:15 + rnorm(15, sd = 3))
ggplot(df.actual, aes(x, y)) +
  geom_point(aes(colour="Actual")) +
  geom_line(aes(colour="Approximate"), data=df.approx)
@hadley
Copy link
Member Author

hadley commented Dec 3, 2009

Another example:

time <- 1:20
d <- data.frame( 
  t = rep(time,2), 
  type = rep(c("sin","cos"),each = 20),
  value= c(sin(time * 2*pi/100), cos(time * 2*pi/100)))
ggplot(d, aes(t, value, colour = type)) + 
  geom_line() + 
  geom_line(subset = .(type == "sin"), linetype = 3, size = 2)

@hadley
Copy link
Member Author

hadley commented Dec 3, 2009

And possibly this one too:

set.seed(123)
x <- paste("a", 1:16, sep="")
y <- gl(2, 8, labels = c("Control", "Treat"))
z <- runif(16) * 5
df <- data.frame(x,y,z)

ggplot(df, aes(z, x, color=y)) + 
  geom_point()
last_plot() + geom_vline(xintercept = 1)

@hadley
Copy link
Member Author

hadley commented Jul 18, 2010

And one more:

dat <- structure(list(x = c(1.9999999, 1.9999998, 1.9999997, 1.9999996, 
14.0000001, 14.0000002, 14.0000003, 14.0000004), y = c(567.385, 
569.415, 560.28, 570.43, 501.41, 499.38, 503.44, 504.455)), .Names = c("x", 
"y"), row.names = c(NA, -8L), class = "data.frame")

ggplot(dat, aes(x,y)) + 
  geom_point(aes(colour = "measurement")) + 
  stat_smooth(aes(colour =  "smooth"), method = lm) + 
  geom_hline(aes(colour = "mean", yintercept=480))

@ghost ghost assigned kohske Dec 2, 2011
@hadley
Copy link
Member Author

hadley commented Dec 2, 2011

Another one for you :)

@kohske
Copy link
Collaborator

kohske commented Dec 2, 2011

Maybe I will rewrite the legend-layer-scale mapping. see also #225 (comment)
So this is in my todo list.

@hadley
Copy link
Member Author

hadley commented Feb 24, 2014

That sounds like a great feature, but unfortunately we don't currently have the development bandwidth to support it. If you'd like to submit a pull request that implements this feature, please follow the instructions in the development vignette.

@hadley hadley closed this as completed Feb 24, 2014
hadley pushed a commit that referenced this issue Feb 1, 2016
Merge from hadley/master
@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants