-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Default style proposal: outward tick marks #4502
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
Comments
This makes so much sense. I never noticed it but now I will everyday. This must be done. |
The chart you show is a great motivating example. |
I have a code snippet I use all the time that puts the tick marks outside for this exact reason. So I'm all for it. |
@mlgill If you know where in the code to change the default, could you prep a quick PR and reference this issue? |
@MrTomWhite Changing the tick mark direction, what I was referring to, is a setting that is applied after the plot is made.... And I definitely don't have the time to be dealing with PRs right now. |
I should note that the code for doing this on a particular axis is this: ax.get_xaxis().set_tick_params(direction='out', width=1)
ax.get_yaxis().set_tick_params(direction='out', width=1)
``
It is not too difficult, but definitely not something average users are going to remember off the top of their heads. |
Oh, the |
Could also look at the seaborn Should also mention that R base plots look this way by default. |
On 2015/06/07 3:48 PM, Brian E. Granger wrote:
More generally, it is also controlled by matplotlibrc, or by modifying e.g. in your matplotlibrc: xtick.direction : out etc. Eric
|
I should note that if there isn't enough support to change the default on On Sun, Jun 7, 2015 at 7:06 PM, Eric Firing notifications@github.com
Brian E. Granger |
For extra histogram fun, try plotting a non-normal distribution with lots of bins:
Notice how the leftmost and rightmost bars have mysteriously turned into stacked bars or... something? wtf is this? OHH right it's just really confusing ticks. [EDIT: whether you have to use 100 or 200 to get the exact effect I'm referring to seems to depend on the matplotlib version in some way I don't understand... historically it's been 100 for me, and it seems to be 100 for @ellisonbg below, but I seem to need 200 now, so eh, try both if you don't see what I'm talking about.] |
As for making a PR for this: my suggestion would be to:
And then we can accumulate all the visual changes for 2.0 in the "_matplotlib2.0" style, and when we're done we rename "_matplotlib2.0" -> "matplotlib2.0", release 1.last, and then switch our default to be |
I prefer the outward tick marks, and support making outward (vs. inward) tick marks the default. |
A figure with inward ticks looks better. Many journals stress in their submission/publication guidelines that figure tick marks must point inward. |
@njsmith I like the idea of using style sheet to help migrate the style work. The only thing that is a bit difficult is that the defaults are not in style sheets, but hardcoded in the rcParams definition in the code. For 2.0 wouldn't we want to be making the changes to the defaults there and offering a matplotlib1 stylesheet to allow users to move back? I am just not sure what the best way to handle this is... |
Overall the reaction to this proposal seems positive. Based on this I have been making some fine tweaks of the tick mark styles. Here I compare the same plot with diferent tick mark styles: Here is the current default style with tick marks in: For the following two examples (with tick marks out) I have increased the line widths of the tick marks from the existing This one (A) keeps the existing tick mark sizes/lengths of (4,2) for major/minor tick marks: This one (B) increases the tick mark sizes/lengths to (6,3) for major/minor tick marks (the ticks style of seaborn uses these settings): Any preferences for A or B?
|
Also, here the examples of @njsmith above. First in the current default style: Now in style (A): |
The other commenters in this thread have given some pretty objective reasons why outward ticks are better both in theory and in specific cases. Can you provide any evidence for "looks better", or at least provide links to a few of these submission guidelines? @ellisonbg: |
@njsmith ahh, yes, I have updated those examples in place with 100 bins and now they show exactly what you were talking about. |
@ellisonbg: Also, I vote for B, both because I like it, and also because "just do what seaborn does" is a good way avoid endless bikeshedding over tiny details. I think literally everyone agrees that seaborn has prettier and more thoughtful visual defaults than matplotlib :-). Regarding the stylesheet thing -- yeah, I dunno what's most maintainable... from the user point of view I think the goal is that we somehow arrange it so that 1.last has |
Moving over the handling config using traitlets would help manage all of the defaults and styles. But for now, I think the number of changes we would be making are really small, so doing it my hand is probably fine. Question: would it be tolerable to have call to |
@njsmith A few examples where it is explicitly stressed that outward ticks are not allowed:
Outward pointing tick marks are recommended in statistical data graphying, but I couldn't find any physics or (applied) math journal displaying such figures. |
The Taylor and Francis document is itself inconsistent. When discussing I don't disagree that inward tick marks are common in certain journals. But I think there are situations where inward tick marks can be used On Mon, Jun 8, 2015 at 12:34 AM, Emilia Petrisor notifications@github.com
Brian E. Granger |
A quick look at Science shows some plots with inward ticks, others with outward. In any case, it will be impossible to find a default style that matches every journal's requirements. The purpose of default style settings is to make plots that work well in the early and middle stages of work--for seeing one's results, and for conveying them efficiently to colleagues via screen, projector, and printer output. For the last stage, publication (and the more polished web and conference presentations) it is understood that additional customization will usually be needed. |
I like outward ticks where there are tick labels, but inward (or none) on On Mon, Jun 8, 2015 at 4:08 AM, Eric Firing notifications@github.com
|
Could someone add the "default changes" tag to this issue as I would like this one to be considered for the default style changes. |
To summarize some of the points that need to be considered along with the outward tick marks:
@tacaswell do I need to submit a PR for this to have it considered for the 2.0 release? The rcParams changes are trivial, but the code to add the axis limit ticks would be a bit more work (help?). I am also traveling for another week and a half and have limited coding time. |
I disagree about forcing tick marks to fall at the limits of each axis, actually. Here's some carefully hand-tweak autocorrelation functions from my thesis: Notice how to make these figures work, it's crucial both that the ticks go outward, and also that we don't put the lower axis limits quite at 0, because if we did then the data and the axes would bump into each other and make the figure unreadable. Forcing the addition of some extra tick marks labeling -0.05 or whatever would look absolutely awful. For comparison, here's how R and current matplotlib handle that first plot by default: R: Matplotlib: The R version isn't as nice as the hand-tweaked version at the top, but it's functional in a way that the matplotlib just isn't. |
I would say they make sense only for positions where the end of one |
Is the spine logic even aware of the ticker in such a way to know if a tick On Mon, Aug 10, 2015 at 6:10 AM, Eric Firing notifications@github.com
|
I don't think so, but they are both children of |
On the topic of ticks: with 1.5 it is now possible to disable top and right spines, but not ticks. So adding |
Till, can you make a new issue for an rc param to turn off the ticks by Tom On Thu, Sep 17, 2015 at 4:28 PM Till Stensitzki notifications@github.com
|
FWIW, I was surprised today to see this new default, and am very much against it. While I can see situations where this can be useful, the following simple example is in my opinion worse than before: I think what bugs me is the outward ticks on the top and right axes. Many of the examples I've found that look ok with outward ticks have ticks only on the left and bottom axes and no axes on the top and right. I don't think mixing the full axes box and outward ticks works. I'm not expecting the default to be changed back of course, but just wanted to make sure I voiced an opinion as a user, in case others feel the same. |
In many cases, there are reasons to remove the T+R axes+ticks. This usually makes sense when there is no/little data in the upper right portion of the plot that you need to judge the position of visually. Another approach is to put always keep the B+L axes+ticks and use grid lines to guide the eye. That is the route that vega-lite as gone: I think the vega-lite style works well in general, but as a default in matplotlib, I think using grid lines by default is going a bit too far from. Thus the box+tick marks. What I don't think is appropriate as a default style is to have no T+R axes+ticks and no grid lines. Then there is too little to guide the eye. I have described the reasoning for outward tick marks above and won't repeat it again. |
I would like to propose making tick marks point outward by default (and for the 2.0 release). The idea for this comes from William Cleveland's Elements of Graphing Data. I quote directly from him:
The idea is really simple. Data belongs on the inside of the axes frame. If your tick marks point inwards, there is a good chance that the tick marks and data will interfere. This type of interference happens often in practice with dense amounts of data in line/scatter plots and with all kinds of color/surface plots. Here is a simple example:
The tick marks on a a default styled
pcolor
plot are almost impossible to see along some borders:The tick marks outwards become extremely helpful and visible:
Cleveland's way of describing this choice also helps me to understand the default visual styling of ggplot2 and seaborn, which use a) no tick marks and b) light grid lines against a grey bg. This is simply a different way of providing the visual guides for plots that don't interfere with the data itself. The other option for the defaults would be to move in this direction (no tick marks with light grid lines on a grey bg), but I think that is probably too much change for the defaults.
The text was updated successfully, but these errors were encountered: