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: clabel manual spacing was incorrect#9989

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
dstansby merged 2 commits intomatplotlib:masterfromjklymak:Fix-clabel-manual-space
Dec 14, 2017

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedDec 12, 2017
edited
Loading

PR Summary

Fixes#9988. This fails some tests, but I'd argue it fails them correctly. Certainly the situation in#9988 is not acceptable.

The tests weren't catching this error because the test figure dpi is 72, so the tests look OK.

Before

figure_1-2

After

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant

@@ -177,7 +177,7 @@ def test_contour_manual_labels():
x, y = np.meshgrid(np.arange(0, 10), np.arange(0, 10))
z = np.max(np.dstack([abs(x), abs(y)]), 2)

plt.figure(figsize=(6, 2))
plt.figure(figsize=(6, 2), dpi=200)
Copy link
Member

Choose a reason for hiding this comment

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

Why didn't this make the test images bigger?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

umm, I think because the printed version doesn't care about figure dpi? There must be a way to change the test image dpi.... I'll check Thanks

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

Choose a reason for hiding this comment

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

How big size wise is the new image? Would we get the same effect going down?

@tacaswell
Copy link
Member

While you are regenerating the manual contour label test images can you also remove the text?

@jklymak
Copy link
MemberAuthor

@tacaswell Is this really the best test to remove text?

@jklymakjklymakforce-pushed theFix-clabel-manual-space branch fromd9ea329 to3901966CompareDecember 13, 2017 02:05
@@ -575,6 +575,7 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
# Get label width for rotating labels and breaking contours
lw = self.get_label_width(self.labelLevelList[lmin],
self.labelFmt, self.labelFontSizeList[lmin])
lw *= self.ax.figure.dpi / 72.0
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment about units?

From the conversion we are getting pts out of theget_label_width andcalc_label_rot_and_inline is expecting pixels (and the doc strings seem to agree).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I just copied the same line in the vanilla label below. I’ll readily admit I don’t understand why this stuff is all such a mess.

Copy link
Member

Choose a reason for hiding this comment

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

Because implicit units are hard 😈 and we used to default to 80dpi on the screen so subtle things like this are easy to miss.

jklymak reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

OK, I get it now. Its a little funny this uses the heuristic of 0.6 * fontsize * len(str) to get the width. I thought we had better ways to do that, but maybe we pre-draw first to do that. Anyway, that can be for a future day...

@tacaswell
Copy link
Member

The text will only pull off the tick labels, the contour labels will still be there. The less places we have the tick labels the less our exposure to the freetype issues are.

@tacaswell
Copy link
Member

Sorry to keep asking you to re-re-generate the images. Moving them to the 'mpl20' style would also be good (remove jet!).

@jklymak
Copy link
MemberAuthor

Ok hang on if I remove jet then I have to redo all the images. Did you want that? I can easily remove the other text decorations.

@jklymakjklymakforce-pushed theFix-clabel-manual-space branch from3901966 to934b936CompareDecember 13, 2017 03:15
@tacaswell
Copy link
Member

Just re-do the ones you have already touched. It isn't a huge deal either way, but we will eventually want to move away from 'classic' for the tests.

@jklymakjklymakforce-pushed theFix-clabel-manual-space branch from934b936 to815601dCompareDecember 13, 2017 03:24
@jklymak
Copy link
MemberAuthor

Yes, sorry, I thought it was done on a per-file basis, but I figured out how to do it per-test

@dstansbydstansby merged commit49d5ced intomatplotlib:masterDec 14, 2017
@QuLogicQuLogic modified the milestones:needs sorting,v2.2.0Feb 12, 2018
@jklymakjklymak deleted the Fix-clabel-manual-space branchMarch 5, 2019 16:10
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v2.2.0
Development

Successfully merging this pull request may close these issues.

Contours are not removed correctly when using clabel with manual
4 participants
@jklymak@tacaswell@dstansby@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp