Closed krassowski closed 4 years ago
Thanks for reporting this issue. I've fixed it in the underlying gridtext package. You'll have to update that package for the fix to work.
library(ggplot2)
library(ggtext)
df <- data.frame(
label = c("Some text **in bold.**"),
x = c(.5),
y = c(.5)
)
ggplot(df) +
aes(x, y, label = label) +
geom_richtext(
label.padding = unit(0.5, "lines")
)
Created on 2019-12-19 by the reprex package (v0.3.0)
Thanks again for this package! It's a huge help for me, and I would love to help making it even better.
Description: The
label.padding
argument ofgeom_richtext
fails with:when less than four arguments are passed.
I expected that similarly to
geom_label
,unit(0.5, "lines")
would be a valid value.Created on 2019-12-18 by the reprex package (v0.3.0)
Passing all the four values works:
Created on 2019-12-18 by the reprex package (v0.3.0)
It seems to be related to the previously opened issue about the failing
annotate()
#8, which was worked around in c4538ece186c01e06119e025bb57b6f7d2672e6e by adding all four arguments to the default argument indraw_panel()
.The user-level workaround for now would be to use
unit(rep(0.5, 4), "lines")
which is slightly more verbose, but still allows to quickly adjust the value for all four sides.Solution proposition:
Would adding following lines to the body of
geom_richtext()
be a good solution to this issue (it works locally for me)?I would be happy to create a PR if you agree that this is thee way forward.