Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FIX label vertical alignment can now be specified#8081

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 3 commits intomatplotlib:v2.0.xfromNelleV:fix_7906_2.0
Feb 21, 2017
Merged

FIX label vertical alignment can now be specified#8081

QuLogic merged 3 commits intomatplotlib:v2.0.xfromNelleV:fix_7906_2.0
Feb 21, 2017

Conversation

NelleV
Copy link
Member

@NelleVNelleV commentedFeb 15, 2017
edited
Loading

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

  • Document this new parameter
  • add the x equivalent for consistency.

Note: this pull request supersedes#7970

@NelleVNelleV added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelFeb 15, 2017
@NelleVNelleV added this to the2.0.1 (next bug fix release) milestoneFeb 15, 2017
@@ -465,6 +465,11 @@ def validate_font_properties(s):
'verbose',
['silent', 'helpful', 'debug', 'debug-annoying'])

validate_alignment = ValidateInStrings(
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

note to myself. Make this private.

afvincent reacted with laugh emoji
@NelleV
Copy link
MemberAuthor

@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?

@@ -1143,6 +1143,15 @@ def test_bar_tick_label_multiple():
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'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

bar_tick_label_multiple_old_label_alignment (cf. the baseline image name)?

This patch adds two new rcParams allowing to set label alignment. The solereason for the existance of these new parameters is to allow user to reset thestyle to before 2.0 for testing purposes. More specifically, ytick horizontalalignement was changed in a non backward compatible way. xtick verticalalignement was added for API consistency.closes#7905
This allows the public classic stylesheet to be 'more' backward compatible
@NelleVNelleV changed the title[WIP] FIX label vertical alignment can now be specified[MRG] FIX label vertical alignment can now be specifiedFeb 15, 2017
Copy link
Member

@QuLogicQuLogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A few small tweaks, and of course, whether to split vertical/horizontal is still in question.

@@ -271,6 +271,7 @@ ytick.major.left : True # draw y axis left major ticks
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Shouldn't there bextick.alignment added as well?

@@ -1214,6 +1219,9 @@ def validate_animation_writer_path(p):
# fontsize of the ytick labels
'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],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should go in thextick section above.

@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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This test doesn't really have anything to do with#2516.

@@ -78,7 +78,7 @@ def create_figure():


# test compiling a figure to pdf with xelatex
@cleanup(style='classic')
@cleanup(style='_classic_test')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The tests in this file don't actually useclassic, as noted in the pytest conversion; maybe just set them todefault now to reflect what's really going on?

@NelleV
Copy link
MemberAuthor

@QuLogic Comments are fixed.

@tacaswell
Copy link
Member

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.

@tacaswelltacaswell changed the title[MRG] FIX label vertical alignment can now be specified[MRG+1] FIX label vertical alignment can now be specifiedFeb 20, 2017
@QuLogicQuLogic changed the title[MRG+1] FIX label vertical alignment can now be specifiedFIX label vertical alignment can now be specifiedFeb 21, 2017
@QuLogicQuLogic merged commit03e540f intomatplotlib:v2.0.xFeb 21, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@afvincentafvincentafvincent left review comments

@tacaswelltacaswelltacaswell approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v2.0.1
Development

Successfully merging this pull request may close these issues.

4 participants
@NelleV@tacaswell@QuLogic@afvincent

[8]ページ先頭

©2009-2025 Movatter.jp