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
autocomplete variable names within ggplot2 aes() calls #8444
Would LOVE to see this feature, as someone who does a lot of plotting with dfs with all sorts of column names, and sometimes you just cant remember what the exact column name was.
Autocompletion is a major convenience in ggplot functions.
The only ggplot function that I use commonly that does not support it are the facet_ functions.
It would save a bit of time if autocomplete could be implemented there as well. Thanks!
I would suggest that within the same aes() call, to remove already specified aes.
here, should not suggest x.
However, it is fine that x is proposed in a subsequent aes() call.
Second suggestion: after a pipe, suggestions disppear. Suggestions are not the columns, but objects in my global environment.
Maybe it would be better to revert to old behavior with the added benefit of completing aesthetics x, y, color etc. in aes() call, but leave the right side untouched?
Nice! thanks- variable name suggestions now work for facet_wrap for me (Windows; daily build 397).
A little sluggish responsiveness on first run, but probably just due to other tasks running on my laptop.
I believe that issue ultimately comes down to a limitation in how RStudio's autocompletion system tries to find the correct pipe context for a statement. The fact that this code is mixing |> (dplyr pipes) and + (ggplot2 layer additions) causes trouble here.
I'm going to file that as a separate issue to further enhance this autocompletion feature. #14342
Also, just to emphasize once more -- thanks @olivroy for taking the time to test each of these revisions; the feature is far more complete than it would have been without your help!
Activity
iagogv3 commentedon Nov 25, 2020
A few later I added #8459 without having saw this issue. Is it maybe related?
kevinushey commentedon Nov 25, 2020
This issue merely described an unimplemented feature; I suspect yours is similar.
github-actions commentedon May 25, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.
mikebessuille commentedon Jun 1, 2021
We believe this is low priority; unless additional users can justify the importance of this, we will likely not get to it in the near term.
KyBroecker commentedon Jan 5, 2023
Would LOVE to see this feature, as someone who does a lot of plotting with dfs with all sorts of column names, and sometimes you just cant remember what the exact column name was.
8 remaining items
vladtarko commentedon Dec 12, 2023
The autocomplete works if you're using the pipe:
JMLuther commentedon Jan 11, 2024
Autocompletion is a major convenience in ggplot functions.
The only ggplot function that I use commonly that does not support it are the
facet_functions.It would save a bit of time if autocomplete could be implemented there as well. Thanks!
eg, while typing last line here:
kevinushey commentedon Feb 2, 2024
Coming to the next daily builds at https://dailies.rstudio.com. You should be able to see both aesthetics that are relevant to the current geom:
As well as variable names (if any) available from the dataset provided to the ggplot2 call.
We would greatly appreciate any testing and feedback!
olivroy commentedon Feb 5, 2024
Hi, it looks awesome!
I would suggest that within the same
aes()call, to remove already specified aes.here, should not suggest

x.However, it is fine that
xis proposed in a subsequentaes()call.Second suggestion: after a pipe, suggestions disppear. Suggestions are not the columns, but objects in my global environment.

Maybe it would be better to revert to old behavior with the added benefit of completing aesthetics
x,y,coloretc. inaes()call, but leave the right side untouched?JMLuther commentedon Feb 6, 2024
Nice! thanks- variable name suggestions now work for facet_wrap for me (Windows; daily build 397).
A little sluggish responsiveness on first run, but probably just due to other tasks running on my laptop.
olivroy commentedon Feb 7, 2024
@kevinushey an important test case is the following. with a pipe. IIRC, it worked pretty well before the feature.
In the first TAB1, I would expect aes and column names to show up. (including zz)

In TAB2, I would expect column names to show up

TAB3 works as expected currently,

kevinushey commentedon Feb 7, 2024
@olivroy many thanks; I will take a look!
olivroy commentedon Feb 8, 2024
Thanks for taking a look. Everything
Just a tiny issue left I think.
order of the aesthetics suggestions (every case)
Should override completions from
aes(). (this worked correctly the first time. Problem piped or not.Piped data + 2
aes()calls with the same data.There is no variable completion in subsequent
aes()calls for the same data: (my cursor is atshape = <TAB>This works as expected when the data is not piped in.

still working as expected for a new data

And works ok after as well

olivroy commentedon Feb 22, 2024
On the ggplot2 side, it mostly seems good with #14309.
Maybe last tiny thing is that newly created variables show in the first
aes()call, but not in the following ones.Shown: (note that some variables are missing, but this issue is a broader issue (that shows in other context) a fix to #14311 locks that in!


Not shown
(Took a while to isolate things, but I think I have a good understanding now!)
kevinushey commentedon Feb 28, 2024
I believe that issue ultimately comes down to a limitation in how RStudio's autocompletion system tries to find the correct pipe context for a statement. The fact that this code is mixing
|>(dplyr pipes) and+(ggplot2 layer additions) causes trouble here.I'm going to file that as a separate issue to further enhance this autocompletion feature. #14342
kevinushey commentedon Feb 28, 2024
Also, just to emphasize once more -- thanks @olivroy for taking the time to test each of these revisions; the feature is far more complete than it would have been without your help!