Skip to content

Gridlines on top of plot by default in 2.0? #5980

Closed

Description

@pbreach

I know the window for default style change proposals has long since closed, but as an avid user who is excited to see the new changes I thought I should ask about this (maybe not the best place either).

After seeing the recently built devdocs I've noticed the grid lines are now placed on top of the plot. Was this intentional? If so feel free to close this. If not it would be great to see them placed behind the plotted data by default. The new lines look great, but I think the data should come first as done previously.

Just my two cents. Keep up the great work.

Activity

  1. efiring commented on Feb 9, 2016

    @efiring
    Member

    I don't think that was intentional, so thanks for pointing it out. I think we would want the grid to be behind lines and markers, but on top of major filled areas like images and filled contours. It's not obvious to me how to handle histograms, bars, and pies, but maybe they should also be on top by default.

  2. added this to the milestone on Feb 9, 2016
  3. Tillsten commented on Feb 9, 2016

    @Tillsten
    Contributor

    This is actually not a new change, they were always drawn on top. One had to use set_axisbelow to get the grid in the background, which annoyinglyalso changed the zorder of the other artists of the axis. The behavior just got more visible due to the new gridlines style.

  4. pbreach commented on Feb 9, 2016

    @pbreach
    Author

    Hmmm... I've honestly never noticed that until now. Well maybe it's worth looking at if not now then never. Plots like this are super obvious:

    image

    @efiring Good point on the different plot types. I guess there might be some subjectivity on whether to put the grid infront or behind certain plot types (and combinations) if a default set of rules were to be established. Maybe looking to other plotting packages could be useful.

    On the other hand, incorporating a zorder kwarg in the grid method would probably be do-able and wouldn't have to be part of the default style changes?

  5. efiring commented on Feb 9, 2016

    @efiring
    Member

    Looking at the code, I don't think this is correct. set_axisbelow gives the grid a zorder of 0.5; otherwise it is 2.5. I don't think anything else is changed. It looks to me like a value of 1.5 might actually be a good default. Furthermore, it is a shame to have set_axisbelow as a Boolean when it could offer finer control, such as a range of options.
    @pbreach the grid method already accepts a zorder kwarg; it accepts the full set of Line2D kwargs, and zorder is inherited from the Artist base class.

  6. efiring commented on Feb 9, 2016

    @efiring
    Member

    On second thought, I'm leaning toward the present 0.5 set_axisbelow value, and the idea that this should be the default now. With the new grid lines, the plotted data look like they are in a federal penitentiary.

  7. Tillsten commented on Feb 9, 2016

    @Tillsten
    Contributor

    @efiring IRC the zorder kwargs get overwritten later, i will check that. (Yep, zorder does nothing)
    What i saw in some other PR was the proposal that it should be in front of contour, contourf, pcolormesh and image and below everything else, which is properly a good default for most cases. Also the decoupling of the grid/rest of axis of zordner would be a nice feature.

  8. u55 commented on Feb 9, 2016

    @u55
    Contributor

    There is a related issue here: #4243.

  9. efiring commented on May 2, 2016

    @efiring
    Member

    closed by #6287

  10. fdeheeger commented on Sep 24, 2016

    @fdeheeger

    While testing the 2.0.0b4, I faced the same question regarding bar plot. Grid on top of bars did not feel right to me (personal perception).
    I just wanted to raise the question as I did not find any issue talking about that point, but I might be wrong. Feel free to close if already discussed.

  11. efiring commented on Sep 24, 2016

    @efiring
    Member

    It was discussed and is already closed; you have a good point, but the problem is that for some patch-like objects the grid works best on top, and for others below. Rather than putting in a bunch of special-case logic, we ended up deciding on the present default. Maybe we will regret it and have to add the special-case logic later, but for now (v2.0) this was the decision.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions