-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Custom key glyph sizes #5465
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
Custom key glyph sizes #5465
Conversation
Maybe instead of this being encoded in attributes, it would be better to use the |
I experimented with this, but it is more of a hassle than as a solution. The main issue I'm encountering is that when setting a viewport on a key that doesn't have one based on the |
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.
LGTM
This PR aims to fix a roadblock in #5454 by providing a mechanism by which keys can set custom sizes.
The problem is that it is heuristically okay, but sometimes inconvenient, for the legend key size to be determined by only the
linewidth
andsize
column in the data. For example, consider the following case when displaying arrows, where arrowhead size exceeds the allotted size on the legend:With this PR, key drawing functions can set their size by attaching a
"width"
and/or"height"
attribute to the produced grob (in cm).For example, for arrows we might sketch the following key drawing function, which incorporates the dimensions of the arrowhead in these attributes. (Note that this isn't quite perfect, since the glyphs go from 0.1npc to 0.9npc, but it illustrates the point)
Now we can have less funky legend keys for the arrows:
Created on 2023-10-10 with reprex v2.0.2