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
AnchoredSizeBar does not respect FontProperties size setting. #2394
Comments
Setting the font size with integers directly seems to work, but set_weight('bold') is being ignored also. |
Trying to set the weight with absolute numbers (according to docs between 0...1000) does NOT work. |
Thanks @michaelaye - looks like this could be a pretty easy fix. Fancy having a go? |
Hey guys, I was taking a look at this issue and I noticed that AnchoredSizeBar has another parameter in it's constructor called "fontproperties" and when I used that to set the font properties it seemed to work. The "prop" parameter seems to be passed on to the parent constructor and inside of a comment in AnchoredOffsetbox it says that "prop : font property. This is only used as a reference for paddings." So that would explain why it wasn't actually adjusting the font size. It seems a little redundant, so we could either keep it the way it is or remove "fontproperties" and just use the "prop" parameter. Just an idea, let me know what you think! |
@nickpyren At a minimum that should be made clear in the docsttring. Could you put together a PR updating them? We are starting to triage for the 1.4.0 release, getting document changes in for 1.4 (and hence the next major re-rendering of the online docs) is do-able, re-factoring/changing the text api is not. |
@michaelaye Can you confirm that #2951 fixes your problem? |
Is it included in 1.3.1? Edit: Ah, obviously it's not. I'm sorry, I don't have the time to install/compile github versions of MPL. |
in testing I also noticed an issue with re-using I think the following should work on 1.3.1 with no patching:
|
That throws for me: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-aa08d8ed9774> in <module>()
5 fig, ax = subplots(2)
6 ax[0].plot(arange(10))
----> 7 asb = AnchoredSizeBar(ax[0].transData, 5, 'xx-large', loc=8, fontproperties=fp)
8 ax[0].add_artist(asb)
9 ax[1].plot(arange(10))
/Users/maye/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mpl_toolkits/axes_grid1/anchored_artists.pyc in __init__(self, transform, size, label, loc, pad, borderpad, sep, prop, frameon, **kwargs)
87 child=self._box,
88 prop=prop,
---> 89 frameon=frameon, **kwargs)
90
91
/Users/maye/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/offsetbox.pyc in __init__(self, loc, pad, borderpad, child, prop, frameon, bbox_to_anchor, bbox_transform, **kwargs)
908
909 """
--> 910 super(AnchoredOffsetbox, self).__init__(**kwargs)
911
912 self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform)
/Users/maye/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/offsetbox.pyc in __init__(self, *args, **kwargs)
144 def __init__(self, *args, **kwargs):
145
--> 146 super(OffsetBox, self).__init__(*args, **kwargs)
147
148 self._children = []
TypeError: __init__() got an unexpected keyword argument 'fontproperties' |
It looks like in 1.3.1 there is no way to change the font properties. |
Punted to 1.4.x |
The following code should produce very different font sizes in the AnchoredSizeBar text but it just shows the same size:
This code produces the following output on my system:
Env:
EPD 7.3 all recent official updates (= MPL 1.3.0),
IPython 1.0 with QT4 backend on MacOSX 10.8.4
The text was updated successfully, but these errors were encountered: