FIX label vertical alignment can now be specified#8081
FIX label vertical alignment can now be specified#8081QuLogic merged 3 commits intomatplotlib:v2.0.xfrom NelleV:fix_7906_2.0
Conversation
lib/matplotlib/rcsetup.py
Outdated
| 'verbose', | ||
| ['silent', 'helpful', 'debug', 'debug-annoying']) | ||
|
|
||
| validate_alignment = ValidateInStrings( |
There was a problem hiding this comment.
note to myself. Make this private.
|
@tacaswell I am having second thoughts about the API here. There are two possible alignments (horizontal and vertical). Should I rename the rcParams to help identify which of the two alignments we are talking about? |
lib/matplotlib/tests/test_axes.py
Outdated
| ax.bar([1, 2.5], [1, 2], width=[0.2, 0.5], tick_label=['a', 'b'], | ||
| align='center') | ||
|
|
||
| @image_comparison(baseline_images=['bar_tick_label_multiple_old_alignment'], |
There was a problem hiding this comment.
bar_tick_label_multiple_old_label_alignment (cf. the baseline image name)?
This patch adds two new rcParams allowing to set label alignment. The sole reason for the existance of these new parameters is to allow user to reset the style to before 2.0 for testing purposes. More specifically, ytick horizontal alignement was changed in a non backward compatible way. xtick vertical alignement was added for API consistency. closes #7905
This allows the public classic stylesheet to be 'more' backward compatible
QuLogic
left a comment
There was a problem hiding this comment.
A few small tweaks, and of course, whether to split vertical/horizontal is still in question.
| ytick.major.right : True # draw y axis right major ticks | ||
| ytick.minor.left : True # draw y axis left minor ticks | ||
| ytick.minor.right : True # draw y axis right minor ticks | ||
| ytick.alignment : center |
There was a problem hiding this comment.
Shouldn't there be xtick.alignment added as well?
lib/matplotlib/rcsetup.py
Outdated
| 'ytick.labelsize': ['medium', validate_fontsize], | ||
| 'ytick.direction': ['out', six.text_type], # direction of yticks | ||
| 'ytick.alignment': ["center_baseline", _validate_alignment], | ||
| 'xtick.alignment': ["center", _validate_alignment], |
There was a problem hiding this comment.
This should go in the xtick section above.
lib/matplotlib/tests/test_axes.py
Outdated
| @image_comparison(baseline_images=['bar_tick_label_multiple_old_label_alignment'], | ||
| extensions=['png']) | ||
| def test_bar_tick_label_multiple_old_alignment(): | ||
| # From 2516: plot bar with array of string labels for x axis |
There was a problem hiding this comment.
This test doesn't really have anything to do with #2516.
|
|
||
| # test compiling a figure to pdf with xelatex | ||
| @cleanup(style='classic') | ||
| @cleanup(style='_classic_test') |
There was a problem hiding this comment.
The tests in this file don't actually use classic, as noted in the pytest conversion; maybe just set them to default now to reflect what's really going on?
|
@QuLogic Comments are fixed. |
|
I see the case for making it 'ytick.valignment' and 'xtick.halignment', however it adds a bit more verbosity, I don't see the use-case for tweaking the other direction (for one thing I think it would break all of the layout logic), and it breaks a nice symmetry between xtick/ytick. I am 👍 for this going in as-is, and would not protest if the names were changed to be more explicit about what direction they were affecting. |
This patch adds a new rcParams allowing to set label vertical alignment. The
sole reason for the existance of this new parameter is to allow user to reset
the style to before 2.0 for testing purposes.
This patch provides a fix to a very pick backward compatibility break. Unfortunately, the
patch that introduces this break also regenerated the test images. This leads to the introduction of a private _test_class stylesheet, corresponding to our current test suite, and a classic stylesheet which is backward compatible.
refs #7905
TODO
Note: this pull request supersedes #7970