-
Notifications
You must be signed in to change notification settings - Fork 37
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
Legend keys #112
base: master
Are you sure you want to change the base?
Legend keys #112
Conversation
R/draw-keys.R
Outdated
# Calculate offsets that account for textbox size | ||
xoffset <- x[1] * (1 - just$hjust) + x[2] * just$hjust | ||
yoffset <- y[1] * (1 - just$vjust) + y[2] * just$vjust | ||
|
||
# We apply offsets to the grob's viewport so that textbox is remains within | ||
# the bounds of the key area | ||
grob <- editGrob( | ||
grob, | ||
vp = viewport( | ||
x = unit(0.5, "npc") - unit(xoffset, "pt"), | ||
y = unit(0.5, "npc") - unit(yoffset, "pt") | ||
) | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be the default key glyph if it's backwards compatible. I don't know what the status of visual tests is. Haven't looked into it in a long time. I had tons of issues with visual tests (as they would always break with any minor update in the rendering stack), so I've mostly given up on them. Also, looks like the CI framework is outdated and needs to be fixed before tests pass. |
This PR aims to fix #111.
Briefly, it adds a new function:
draw_key_richtext()
that can draw legend keys with formatted text. As a demonstration, we can render a similar reprex to the one given in #111:Created on 2023-12-16 with reprex v2.0.2
There are a few questions/remarks I have about how to proceed:
geom_richtext()
andgeom_textbox()
?Thanks for reading!