Skip to content

Default style proposal: outward tick marks #4502

Closed

Description

@ellisonbg

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:

...tick marks should point outward. This format prevents data from being obscured (page 33)

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:

screen shot 2015-06-07 at 5 40 44 pm

The tick marks outwards become extremely helpful and visible:

screen shot 2015-06-07 at 5 40 50 pm

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.

Activity

  1. neilpanchal commented on Jun 8, 2015

    @neilpanchal

    This makes so much sense. I never noticed it but now I will everyday. This must be done.

  2. mlgill commented on Jun 8, 2015

    @mlgill

    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.

  3. mlgill commented on Jun 8, 2015

    @mlgill

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

  4. ellisonbg commented on Jun 8, 2015

    @ellisonbg
    Author

    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.
  5. ellisonbg commented on Jun 8, 2015

    @ellisonbg
    Author

    Oh, the width=1 part is probably not needed, but I have found it to be nice.

  6. mwaskom commented on Jun 8, 2015

    @mwaskom

    Could also look at the seaborn ticks style which does this through the rcParams. (I actually use it more than the "default" seaborn style for personal work...).

    Should also mention that R base plots look this way by default.

  7. efiring commented on Jun 8, 2015

    @efiring
    Member

    On 2015/06/07 3:48 PM, Brian E. Granger wrote:

    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)
    ``

    Itis not too difficult, but definitelynot something average users are going to remember off the top of their heads.

    More generally, it is also controlled by matplotlibrc, or by modifying
    the corresponding rcParams entries, or by using a style file to handle this.

    e.g. in your matplotlibrc:

    xtick.direction : out
    ytick.direction : out
    xtick.major.width : 1
    ytick.major.width : 1

    etc.

    Eric

    —
    Reply to this email directly or view it on GitHub
    #4502 (comment).

  8. ellisonbg commented on Jun 8, 2015

    @ellisonbg
    Author

    I should note that if there isn't enough support to change the default on
    this, I think it would be nice to have a method to quickly do this on an
    axes (maybe ticks_out and ticks_in).

    On Sun, Jun 7, 2015 at 7:06 PM, Eric Firing [email protected]
    wrote:

    On 2015/06/07 3:48 PM, Brian E. Granger wrote:

    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)
    ``

    Itis not too difficult, but definitelynot something average users are
    going to remember off the top of their heads.

    More generally, it is also controlled by matplotlibrc, or by modifying
    the corresponding rcParams entries, or by using a style file to handle
    this.

    e.g. in your matplotlibrc:

    xtick.direction : out
    ytick.direction : out
    xtick.major.width : 1
    ytick.major.width : 1

    etc.

    Eric

    —
    Reply to this email directly or view it on GitHub
    <
    #4502 (comment)
    .

    —
    Reply to this email directly or view it on GitHub
    #4502 (comment)
    .

    Brian E. Granger
    Cal Poly State University, San Luis Obispo
    @ellisonbg on Twitter and GitHub
    [email protected] and [email protected]

  9. ellisonbg commented on Jun 8, 2015

    @ellisonbg
    Author

    The default histogram styling (tick marks in) is another case where you can be pretty sure you will never see the tick marks along the lower frame:

    screen shot 2015-06-07 at 7 16 45 pm

  10. njsmith commented on Jun 8, 2015

    @njsmith

    For extra histogram fun, try plotting a non-normal distribution with lots of bins:

    plt.hist(np.random.beta(0.5, 0.5, 10000), 100, color="pink")
    

    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.]

  11. njsmith commented on Jun 8, 2015

    @njsmith

    As for making a PR for this: my suggestion would be to:

    • create two new built-in styles called "matplotlib1" and "_matplotlib2.0", which initially are identical to the current default style
    • arrange so that by default we style.use("matplotlib1")
    • make this change to the "_matplotlib2.0" style

    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 style.use("matplotlib2.0") and release 2.0.

  12. gumption commented on Jun 8, 2015

    @gumption

    I prefer the outward tick marks, and support making outward (vs. inward) tick marks the default.

  13. empet commented on Jun 8, 2015

    @empet

    A figure with inward ticks looks better. Many journals stress in their submission/publication guidelines that figure tick marks must point inward.

  14. 35 remaining items

  15. added 3 commits that reference this issue on Nov 25, 2015
    a2fc9ef
    64ff7f3
    23086ba
  16. added 4 commits that reference this issue on Dec 14, 2015
    1a5a774
    5cd08e2
    04420c2
    ec5bc33
  17. added 3 commits that reference this issue on Dec 31, 2015
    20b0716
    2689ef6
    bd2473e
  18. added a commit that references this issue on Jan 25, 2016
    5695389
  19. astrofrog commented on May 17, 2016

    @astrofrog
    Contributor

    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:

    test

    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.

  20. ellisonbg commented on May 17, 2016

    @ellisonbg
    Author

    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:

    screen shot 2016-05-17 at 10 11 14 am

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions