-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Inf
does not maintain annotation within boundaries of plot anymore
#6111
Comments
Thanks for the report! library(ggplot2)
packageVersion("ggplot2")
#> [1] '3.4.3'
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
annotate("text", label = "text", size = 15, x = Inf, y = Inf) Created on 2024-09-17 with reprex v2.1.1 |
Thanks. While I have not changed my function But when I run the script again after a few weeks (and updating my packages), I now get: That function relies on In any case, if that was always the behaviour, I think we can close the issue? Although I would have imagined that it would be sensible to have default values within the boundaries of the plot without having to make custom adjustments, but perhaps this is not easily generalizable to all the possible cases. |
ggrepel geom_text_repel is not the same as geom_text indeed it used to put the inf into the panel a recent bug broke that but I think it was fixed in the last release: |
If this issue occurs in {ggrepel}, this is probably best fixed over there and we can close this issue here. |
When adding an annotation to a plot,
Inf
used to keep the annotation within the frame of the plot. Recently however I noticed that this behaviour has changed with a recent update (of, probably,ggplot2
or one of its dependencies), such that the text is now almost completely hidden outside the borders of the frame when using this historically common "trick". I noticed this change of behaviour in mypkdown
website and personal documents (old vs new).Reprex of the new behaviour:
Created on 2024-09-17 with reprex v2.1.1
Same with
I(1)
:Created on 2024-09-17 with reprex v2.1.1
vjust
andhjust
used not to be necessary for this, or putting them at zero would put them at the edge, but now 0 completly hides:Created on 2024-09-17 with reprex v2.1.1
Whereas the old behaviour can be recovered using
vjust
andhjust
of 1:Created on 2024-09-17 with reprex v2.1.1
Or with "inward":
Created on 2024-09-17 with reprex v2.1.1
Is this a bug or feature introduced by some new changes to
ggplot2
?The text was updated successfully, but these errors were encountered: