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

Should plot with no layers add geom_blank() ? #1246

Closed
hadley opened this issue Aug 5, 2015 · 3 comments
Closed

Should plot with no layers add geom_blank() ? #1246

hadley opened this issue Aug 5, 2015 · 3 comments

Comments

@hadley
Copy link
Member

hadley commented Aug 5, 2015

Instead of current (not very useful behaviour)

@wch
Copy link
Member

wch commented Aug 5, 2015

I think this would be useful in Shiny apps, where layers are added in response to some user input. Right now, if no layers are added, you'd need to do an explicit check for that, and then add geom_blank(). If this automatically happens, then that's less work for the developer, and there's not really any drawbacks that I can think of.

This would happen in the build phase, right?

@hadley
Copy link
Member Author

hadley commented Aug 5, 2015

Yeah, I'd just change:

if (length(plot$layers) == 0) stop("No layers in plot", call. = FALSE)

to

if (length(plot$layers) == 0) {
  plot <- plot + geom_blank()
}

@hadley
Copy link
Member Author

hadley commented Aug 5, 2015

Fixed in 1ab70de

@hadley hadley closed this as completed Aug 5, 2015
@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants