Skip to content

Feature request: default plot argument for layer_*() functions #5166

Description

@teunbrand

I'm estimating that about 4 out of 5 times that layer_data(), layer_grob() or layer_scales() is used, my intention is to get that information from the plot currently on display.

I think it is a good default to have plot = last_plot() be the default value for these functions, for the following reasons:

  • The current default, i.e. no value, is useless in 5 out of 5 times.
  • I can think of no alternative default value that might be useful.
  • It may save folks 11 keystrokes.
  • For people that don't know about last_plot(), as I did for a long time, using last_plot() is more convenient than using
p <- ggplot(...) + ...
layer_data(p)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions