You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
after_scale fails to find some aesthetic variables #3725
I am highlighting some points by a combination of stage() and after_scale().
I found that after_scale can find aesthetic variables, but not variables in the original data.
It is fine, if that's a design.
As a workaround, I let after_scale find the variable in the data by mapping it to an aesthetic variable.
It works in some case, but not always.
As far as I tried, it seems the error is related to discrete variables.
Defining a random aesthetic (highlight) will invariantly lead to undefined behaviour. There is no way to know how the stat and geom will treat it or carry it over. This has always been true and was also the case for the old stat() and ..var.. notations
I agree there's no garantee that such random aesthetics work, but this is a different problem. The problem is that limited variables are used to draw legends. Probably this can happen with more standard aesthetics.
Ah - I see from your comment now. That is a separate issue all together. Can you open a new one?
as for this: after_stat() has only access to columns returned by the stat. after_scale() has only access to the final aesthetics. There is no way columns from the original dataset can be carried over as the data might get changed considerably during preparations
Activity
yutannihilation commentedon Jan 13, 2020
The error seems to occur on drawing legends. I don't get what's the expected behaviour here...
Created on 2020-01-13 by the reprex package (v0.3.0)
thomasp85 commentedon Jan 13, 2020
Defining a random aesthetic (
highlight) will invariantly lead to undefined behaviour. There is no way to know how the stat and geom will treat it or carry it over. This has always been true and was also the case for the oldstat()and..var..notationsyutannihilation commentedon Jan 13, 2020
I agree there's no garantee that such random aesthetics work, but this is a different problem. The problem is that limited variables are used to draw legends. Probably this can happen with more standard aesthetics.
thomasp85 commentedon Jan 13, 2020
I do t think I follow you @yutannihilation — what is the problem with the legend?
yutannihilation commentedon Jan 13, 2020
I'll try creating some example tomorrow...
thomasp85 commentedon Jan 13, 2020
Ah - I see from your comment now. That is a separate issue all together. Can you open a new one?
as for this:
after_stat()has only access to columns returned by the stat.after_scale()has only access to the final aesthetics. There is no way columns from the original dataset can be carried over as the data might get changed considerably during preparationsyutannihilation commentedon Jan 14, 2020
Sure. I don't feel it's a completely different issue, but let's discuss on a new one.
yutannihilation commentedon Jan 14, 2020
@thomasp85 Here it is: #3729