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
Improvements to anchored_artists.AnchoredSizeBar #2585
Conversation
Fix: color argument was not setting the color of the textlabel Add: setting the font-size through the fontsize argument
@@ -71,7 +71,7 @@ class AnchoredSizeBar(AnchoredOffsetbox): | |||
def __init__(self, transform, size, label, loc, | |||
pad=0.1, borderpad=0.1, sep=2, prop=None, | |||
frameon=True, size_vertical=0, color='black', | |||
label_top=False, | |||
label_top=False, fontsize=12, |
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.
Is there an existing rcparam this should respect?
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.
Not that I'm aware of. It might be nice to accept a fontprops argument here, rather than just the size, giving the use more control of the font details.
Hi, I just tested this as I will need this for a projet. A fontprop would be very nice, so we can use any font we want ;) |
@magnunor - this PR is good. We could do with a couple of tests and updating the keyword to accept fontprop for more generic functionality, but other than that I'd be happy to merge. If you can get this done in the next couple of days we will be able to include this improvement in the next release v1.4. Cheers! |
Removed the old fontsize parameter. And fix: some typos in the example in the docstring
I added a fontprops parameter and a test. I'm not sure if any of the old test files were an appropriate place for a test for AnchoredSizeBar, so I made a new file test_anchored_artists.py. |
@@ -71,10 +71,10 @@ class AnchoredSizeBar(AnchoredOffsetbox): | |||
def __init__(self, transform, size, label, loc, | |||
pad=0.1, borderpad=0.1, sep=2, prop=None, | |||
frameon=True, size_vertical=0, color='black', | |||
label_top=False, | |||
label_top=False, fontprops=None, |
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.
Perhaps the argument should be fontproperties and not fontprops
That's what is used for the set_xylabels() or text()
Two changes to the axes_grid1.anchored_artists.AnchoredSizeBar function: