-
Notifications
You must be signed in to change notification settings - Fork 2.1k
update_geom_defaults ignores pointrange's "fatten" #2798
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
Comments
This is because library(ggplot2)
GeomPointrange$default_aes
#> Aesthetic mapping:
#> * `colour` -> "black"
#> * `size` -> 0.5
#> * `linetype` -> 1
#> * `shape` -> 19
#> * `fill` -> NA
#> * `alpha` -> NA
#> * `stroke` -> 1 |
So, this is a feature, not a bug? Can you point me toward a reference that will help me understand why it works this way? |
If you take a look at the source code for Lines 18 to 20 in d3bd92e
but not one of the default aesthetics of the GeomPointrange ggproto object.Lines 30 to 32 in d3bd92e
|
So the docs for the Fatten is actually a parameter not an aesthetic, and thus it can't be updated with library(ggplot2)
GeomPointrange$parameters()
#> [1] "fatten" Broadly you can think of aesthetics as those things that can be mapped to data and a scale, but parameters as things that can only be set to a constant for any given layer. Beyond that, the easiest way to see why this doesn't work is to look at the function itself: Lines 14 to 19 in 0770163
Even without going to deeper to investigate what Does that help? |
woops! @batpigandme beat me to it! |
Thanks for the reference to the source. I understand how it is implemented such that Perhaps it helps to understand my motivation: a script makes several plots; some have points, some have pointranges. I want the points in all plots to end up the same size, so I do some initial calls to |
whoops, when I posted my last message I hadn't seen your explanation about aesthetics vs parameters, @dpseidel. That does clarify why it makes sense to do it this way from an API standpoint. I guess I'm still left wondering why the default is |
Oh good, glad I could help. I admit there are some inconsistencies in defaults! Your issue in fact led me to realize for In the mean time for your issue, in both cases, the |
Can you either reference this issue or tag me in the new one, so I can track when that gets merged? You're right that separate calls to point and errorbar would get me what I want (once errorbar width is globally controllable). |
The distinction between aesthetics and parameters is sometimes not so clear. Historically, ggplot2 has used a fairly limited set of aesthetics, and everything else was parameters. My personal opinion is that we can be more liberal with making things aesthetics, there's no strong technical reason not to. For The problem is these kinds of choices need to be manually implemented separately for each geom, and different geom authors may have slightly different perspectives on how to name things and what to make aesthetics or parameters. |
@clauswilke 👍 for |
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/ |
update_geom_defaults
appears to ignore thefatten
parameter ofgeom_pointrange
. Reprex:Default settings
it works with
size
it doesn't work with
fatten
fatten
does work within the geom callCreated on 2018-08-02 by the reprex package (v0.2.0).
Session info
The text was updated successfully, but these errors were encountered: