home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 953641308

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/5901#issuecomment-953641308 https://api.github.com/repos/pydata/xarray/issues/5901 953641308 IC_kwDOAMm_X84412lc 1562854 2021-10-28T08:48:55Z 2021-10-28T08:48:55Z CONTRIBUTOR

Just to explain the issue a bit: pcolormesh(x, y, Z, shading='flat') was the default. If shape(Z) used to be (len(y), len(x)) matplotlib would drop, without warning, the last row and column of Z so that y and x were one larger than Z.

The new default is 'auto' where in the case above it uses shading='nearest' to create new x and y co-ordinates with the dumbest algorithm possible of placing them in the midpoints, and adding two new points on the outside. So rather than drop data from Z, we add to the x and y co-ordinates.

That is usually fine, except the midpoint between 0 and 360 is 180, and we get a weird wrap. Cartopy (xarray) accounted for this with the old shading by adding a NaN. I've not followed what they are doing now.

To get the old behaviour you simply need to do pcolormesh(x, y, Z[:-1, :-1], shading='flat') or make x and y one larger than Z in each dimension and specify the the corners of the quadrilaterals.

Sorry this is a pain, but the old behaviour of silently dropping data, while having a long lineage going back to Matlab, was deemed unacceptable. However, if this continues to be a nuisance to folks, I'm sure matplotlib would consider a new shading argument, something like 'flat-drop', or somesuch that would do the data dropping for you.

{
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1037814301
Powered by Datasette · Queries took 77.849ms · About: xarray-datasette