Skip to content
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

Shouldn't the 3.1 change to line plot defaults to plot the independent variable vertically if it's vertical or "y" have been only for vertical ones? #4493

Closed
WilliamIngramAtmosphericPhysics opened this issue Jan 11, 2022 · 1 comment · Fixed by #4601
Labels
Good First Issue A good issue to take on if you're just getting started with Iris development Peloton 🚴‍♂️ Target a breakaway issue to be caught and closed by the peloton

Comments

@WilliamIngramAtmosphericPhysics

#3906
seems overdone to me.

https://scitools-iris.readthedocs.io/en/stable/whatsnew/3.1.html?highlight=vertical%20axis#features
says it was "to automatically place the cube on the x axis if the primary coordinate being plotted against is a vertical coordinate" for line plots. That is such standard practice in Earth science that I am confident it would have been coded from the start in a package created by scientists from the field, so I'm totally in favour.

But what was actually implemented is, as stated at
#3906
to "Put cube data on the x axis if plotting just a cube against a vertical or y coordinate", & the addition of "y coordinate" is wrong in my opinion.

I can see how programmers could assume that a dimension that is called "y" by iris would be thought of as "y-axis-like" by scientists, but this is not true. Graphs plotted against latitude conventionally have latitude as the x-axis, the conventional place for the independent variable. (There is one important exception: when the graph against latitude is lined up beside a map, to show e.g. the zonal mean, when of course the map normally has latitude running vertically on the page - but this is a fairly small fraction of cases. I can't remember ever doing it in my career.)

I think any look at the literature will confirm this. Basically I suppose we see the "y axis" of line plots as a vertical, while python's "Y" is horizontal (in all my experience). Where a 2D field is being plotted & one non-vertical dimension has to be vertical on paper, yes, latitude is normally the one, following the general convention for maps, but that's another issue.

So I reckon the "y" part should be reverted - preferably soon, not waiting till lots of people are using a version with the change, disliking it & saying so! (I don't suggest testing for the exceptional case I mentioned as I doubt iris can access the details of a previous plot, let alone a following one, & it needs the zonal-mean plot much narrower than the map so the user will need to get into matplotlib.gridspec anyway, & the change to the call to iris plot to flip from the default is comparatively simple.)

@rcomer
Copy link
Member

rcomer commented Jan 11, 2022

I think this is the offending line

and iris.util.guess_coord_axis(u_object) in ["Y", "Z"]

so reverting the "Y" axis part should just involve changing this to

            and iris.util.guess_coord_axis(u_object) == "Z"

plus updates to associated tests.

Looking back at the original issue #612, it seems it did only propose modifying the vertical cases.

@bjlittle bjlittle added Peloton 🚴‍♂️ Target a breakaway issue to be caught and closed by the peloton Good First Issue A good issue to take on if you're just getting started with Iris development labels Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue A good issue to take on if you're just getting started with Iris development Peloton 🚴‍♂️ Target a breakaway issue to be caught and closed by the peloton
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants