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
adding an annotation works only if global aesthetics have been defined in ggplot().
If there are only "local" aesthetics in individual geoms the annotation will not be drawn (no warning though).
library(ggplot2)
library(grid)
df<-data.frame(x=1:10, y=1:10)
anno<- annotation_custom(grid.rect(draw=FALSE), xmin=7, xmax=10,ymin=1, ymax=2)
## Global aesthetics: works fine
ggplot(df, aes(x=x, y=y)) + geom_point()+anno## "Local" aesthetics: does not work
ggplot() + geom_point(data=df, aes(x=x, y=y))+anno
I tried setting scales and/or coord limits explicitly, but this doesn't make it work either:
Add to news
Fix inherit.aes so dummy data is not called out
Define and use dummy_data() to assign data to annotation layers
Add tests for dummy data and inherit.aes
Uh oh!
There was an error while loading. Please reload this page.
Hi,
adding an annotation works only if global aesthetics have been defined in
ggplot()
.If there are only "local" aesthetics in individual geoms the annotation will not be drawn (no warning though).
I tried setting
scales
and/orcoord
limits explicitly, but this doesn't make it work either:The text was updated successfully, but these errors were encountered: