Legend keys#112
Open
teunbrand wants to merge 5 commits intowilkelab:masterfrom
Open
Conversation
teunbrand
commented
Dec 16, 2023
Comment on lines
+70
to
+83
| # 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") | ||
| ) | ||
| ) | ||
|
|
Author
Collaborator
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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!