home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1338173609

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1338173609 I_kwDOAMm_X85Pwuip 6914 plt.imshow() vs xarray_dataset.plot.imshow() not rendering correctly | Potential Bug 32569566 closed 0     4 2022-08-14T08:40:56Z 2023-03-22T20:46:23Z 2023-03-22T20:46:23Z NONE      

What is your issue?

I have 2d data which I want to visualise. The visuals look completely different if I use plt.imshow() vs xarray_dataset.plot.imshow() There are mainly two issues - First, the array is flipped. (I think this is manageable but inconsistent) - Secondly, the plots don't look correct. This can be best illustrated by the figures themselves.

For example this is the xarray code I am using.

day_data.plot.imshow(cmap= "Blues", vmin =1, vmax = 100) plt.show()

And this is the image that I get.

Secondly, when I use the matplotlib to plot the values. plt.imshow(day_data.values, vmin = 1, vmax = 100, cmap = 'Blues') plt.show() I get this plot.

Since it is a discharge data I would expect to see the second plot. Can someone tell me what is the issue here?

P.S.

This is how day_data looks like.

xarray.DataArray'dis06'y: 950x: 1000 array([[nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], ..., [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan]], dtype=float32) Coordinates: time () datetime64[ns] 2019-10-24T06:00:00 step () timedelta64[ns] 06:00:00 surface () float64 0.0 latitude (y, x) float64 ... longitude (y, x) float64 ... valid_time () datetime64[ns] 2019-10-24T12:00:00 Attributes: GRIB_paramId : 240023 GRIB_dataType : sfo GRIB_numberOfPoints : 950000 GRIB_typeOfLevel : surface GRIB_stepUnits : 1 GRIB_stepType : avg GRIB_gridType : lambert_azimuthal_equal_area GRIB_NV : 0 GRIB_cfName : unknown GRIB_cfVarName : dis06 GRIB_gridDefinitionDescription : Lambert azimuthal equal area projection GRIB_missingValue : 9999 GRIB_name : Mean discharge in the last 6 hours GRIB_shortName : dis06 GRIB_units : m**3 s**-1 long_name : Mean discharge in the last 6 hours units : m**3 s**-1 standard_name : unknown

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6914/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 3 rows from issues_id in issues_labels
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 84.887ms · About: xarray-datasette