Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix anatomy figure on v2.x #7128

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

Merged
merged 1 commit into from
Nov 17, 2016
Merged

Fix anatomy figure on v2.x #7128

merged 1 commit into from
Nov 17, 2016

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Sep 18, 2016

  • Enable black edges on scatter markers. Also, use plot instead of scatter for @efiring.
  • Move major and minor tick annotation to left side, where they're visible.
  • Shift tick label and axis label annotations outward to match corrected handling of tick length.
  • Don't disable legend frame, which is not very distracting any more.
  • Don't set figure facecolor, which is already white by default now.
  • Use AutoMinorLocator to avoid minor ticks overlaying major ticks, causing a small glitch due to antialiasing.

Fixes #7113.

@QuLogic QuLogic added this to the 2.0 (style change major release) milestone Sep 18, 2016
@NelleV
Copy link
Member

NelleV commented Sep 18, 2016

Can you please put the tick inwards back? It doesn't look very good as is.

@NelleV
Copy link
Member

NelleV commented Sep 18, 2016

The changes of code are fine. The changes in the styles are not looking very good. Can you please revert how the figure looks as it was before?

@QuLogic
Copy link
Member Author

QuLogic commented Sep 18, 2016

Outward ticks are the new default; I don't see why this figure should not follow that.

@NelleV
Copy link
Member

NelleV commented Sep 18, 2016

Because inward ticks look much much better on this plot.
Defaults only make the default plots look OK, but you'll never have a decent looking plot using the defaults. Considering this is a showcase plot, let's try to keep it good looking (and it turns out that Nicolas is a visualization expert, so the closer we stick to his design, the better it is).

@tacaswell
Copy link
Member

An argument for leaving the ticks pointing out in this example is that it is the new default and, aesthetics aside, leaving the defaults in this example will confuse new users less.

@NelleV
Copy link
Member

NelleV commented Sep 19, 2016

We have 100 examples with the defaults in the gallery, and we are lacking nice looking one. I don't think it is worth adding this with the current design. It does not illustrate anything, and presents IMO no interest with the new version.
FYI, users also need to learn how to create nice plots, and you can't and will never be able to do this by using defaults.

@efiring
Copy link
Member

efiring commented Sep 19, 2016

This plot is full of customizations, so adding one more--inward ticks--is no big deal. It won't increase the confusion.

On the other hand, I think that leaving the ticks outward is reasonable; if it is so horrible for a rather generic type of plot like this, then it is probably a bad default. I was not a fan of the switch from in to out in the default, which required many other changes, but now I'm accustomed to it, and to me it looks OK here. It actually makes it a little clearer what the ticks are.

What I think would be an improvement, however, would be scaling up the font sizes that are not specified directly in points to be more similar to those in the original version, given that the figure size is considerably larger than the default. You can start by using rcParams['font.size']. The default is 10, so I would try 11 and 12. And/or make the figure smaller. 8 inches square is a bit large both for screens (especially laptops) and for paper, so I would prefer a reduction. Unfortunately that would require adjusting the font specifications that are in points, and probably fiddling with some other parameters.

@efiring
Copy link
Member

efiring commented Sep 19, 2016

On 2016/09/18 2:41 PM, Nelle Varoquaux wrote:

We have 100 examples with the defaults in the gallery, and we are
lacking nice looking one. I don't think it is worth adding this with the
current design. It does not illustrate anything, and presents IMO no
interest with the new version.

If it doesn't illustrate anything useful, and its value is entirely in
the beauty of its original version, then perhaps it shouldn't go in at
all. What is its intended purpose?

If it does go in it must be generated with version 2 without specifying
"classic" style, so it needs explicit customizations.

FYI, users also need to learn how to create nice plots, and you can't
and will never be able to do this by using defaults.

I think you are overstating your case. But yes, we should have
documentation and examples that show how to get good design--more
effective as well as pleasing plots--via customization. And some of the
present gallery examples need work--some, like
http://matplotlib.org/devdocs/examples/api/engineering_formatter.html,
are horrible.

@NelleV
Copy link
Member

NelleV commented Sep 19, 2016

@efiring it went in the showcase section, so yes, I think it's primary goal is too look good.

Some examples are horrible, but illustrate a concept or a plot, so for these, I wouldn't worry too much.

@QuLogic
Copy link
Member Author

QuLogic commented Sep 19, 2016

I'm not sure we have a showcase section; I don't think I would call where this image goes a showcase. It is in the FAQ describing the parts of a figure, which is not exactly front-and-foremost unless you go looking for it.

Moving it to the tutorial might be a good idea; I've seen students be mildly confused until they heard, in some general form, the layout of what is being created. Relatedly, it seems that maybe some of that text needs updating as it references things that were in the old image.

@NelleV
Copy link
Member

NelleV commented Sep 19, 2016

The showcase section is here: http://matplotlib.org/gallery.html#showcase

@tacaswell
Copy link
Member

I think part of the tension here is that this was originally aimed at the showcase section, but I also asked @rougier to use this in the FAQ to replace the previous anatomy of a figure image.

It may be that we want to have slightly different versions of the same figure in those two cases.

@QuLogic
Copy link
Member Author

QuLogic commented Sep 19, 2016

Yes, I think we are discussing it with different aims in mind that are perhaps not entirely compatible with each other.

I realize that's this is rather subjective assessment, but trying out inward ticks on 2.x, I don't think it looks terrible, but I also don't think it looks better than outward ticks. Going that route, major ticks might also need to be widened to be more visible. For reference, here is what it looks like with inward ticks on 2.x (and no other changes; some things may not be aligned any more):
anatomy_in

@rougier
Copy link
Member

rougier commented Sep 19, 2016

My 2c but:

  • Major tick label is not centered on label.
  • Box around legend is not necessay
  • Circles major tick is hardly visible (because of the label)
  • X & Y axis label circles are not y centered on labels

@QuLogic
Copy link
Member Author

QuLogic commented Sep 19, 2016

Don't look at the one above unless you want inward ticks; I have not adjusted anything for the inward ticks. The outward ticks version is in the commit and has (mostly) aligned elements.

@rougier
Copy link
Member

rougier commented Sep 19, 2016

Ok.

@NelleV NelleV modified the milestones: 2.0.1 (next bug fix release), 2.0 (style change major release) Oct 31, 2016
@QuLogic
Copy link
Member Author

QuLogic commented Nov 15, 2016

@rougier So is that an okay for the outward tick version or just a general acknowledgement of the situation?

@rougier
Copy link
Member

rougier commented Nov 15, 2016

Some comments:

  • http -> https
  • dashes on the grid seems to have a problem (look at horizontal line at y=2 for example)
  • vertical dash in the center of figure seems to disappear
  • Visual "glitch" where major and minor ticks cover each other
  • Title a bit too close from the axes

@QuLogic
Copy link
Member Author

QuLogic commented Nov 15, 2016

http -> https

matplotlib.org is not TLS-capable.

dashes on the grid seems to have a problem (look at horizontal line at y=2 for example)
vertical dash in the center of figure seems to disappear

I think there are some points overlaying it in white, though I thought I fixed it by adding the black edges on the scatters. I will check it more closely.

Visual "glitch" where major and minor ticks cover each other

Not sure if there's an easy fix for that; I think it might be an antialiasing thing, because both ticks are the same width.

Title a bit too close from the axes

I wish it did that automatically...

@QuLogic
Copy link
Member Author

QuLogic commented Nov 15, 2016

I fixed the weird dashing; it's because of the change from scatter to plot that @efiring requested. I forgot to set the linewidth to 0 to hide the lines (which were white.) I made them 0-width and also switched from c to markerfacecolor to be a bit more explicit.

The title is also a little bit higher just by setting the alignment to 'bottom' instead of 'baseline'.

I'm not sure if I can do anything about the ticks overlapping.

@rougier
Copy link
Member

rougier commented Nov 15, 2016

For the tick, I think the problem comes from the aliasing. The ideal solution would be to not display the minor tick when there is a major tick but that might be too much trouble.

@rougier
Copy link
Member

rougier commented Nov 15, 2016

Add the figure is fine for me now.

@QuLogic
Copy link
Member Author

QuLogic commented Nov 15, 2016

Turns out that AutoMinorLocator will do that, so if I change:

ax.xaxis.set_major_locator(MultipleLocator(1.000))
ax.xaxis.set_minor_locator(MultipleLocator(0.250))
ax.yaxis.set_major_locator(MultipleLocator(1.000))
ax.yaxis.set_minor_locator(MultipleLocator(0.250))

to

ax.xaxis.set_major_locator(MultipleLocator(1.000))
ax.xaxis.set_minor_locator(AutoMinorLocator(4))
ax.yaxis.set_major_locator(MultipleLocator(1.000))
ax.yaxis.set_minor_locator(AutoMinorLocator(4))

then I get this, with no overlapping ticks:
figure_1-5

* Enable black edges on scatter markers. Also, use `plot` instead of
  `scatter` for @efiring.
* Move major and minor tick annotation to left side, where they're
  visible.
* Shift tick label and axis label annotations outward to match corrected
  handling of tick length.
* Don't disable legend frame, which is not very distracting any more.
* Don't set figure facecolor, which is already white by default now.
* Use AutoMinorLocator to avoid minor ticks overlaying major ticks,
  causing a small glitch due to antialiasing.

Fixes matplotlib#7113.
@QuLogic QuLogic changed the title Fix anatomy figure on v2.x [MRG] Fix anatomy figure on v2.x Nov 16, 2016
@efiring efiring changed the title [MRG] Fix anatomy figure on v2.x Fix anatomy figure on v2.x Nov 17, 2016
@efiring efiring merged commit 39c7d1e into matplotlib:v2.x Nov 17, 2016
@QuLogic QuLogic deleted the fix-anatomy branch November 17, 2016 02:38
@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0 (style change major release) Dec 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants