home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 283566613

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
283566613 MDExOlB1bGxSZXF1ZXN0MTU5NDE5NjYw 1796 Support RGB[A] arrays in plot.imshow() 12229877 closed 0     16 2017-12-20T13:43:16Z 2018-01-11T03:20:02Z 2018-01-11T03:14:36Z CONTRIBUTOR   0 pydata/xarray/pulls/1796
  • [x] Tests added (for all bug fixes or enhancements)
  • [x] Tests passed (for all non-documentation changes)
  • [x] Passes git diff upstream/master **/*py | flake8 --diff
  • [x] Fully documented, including whats-new.rst for all changes

This patch brings xarray.plot.imshow up to parity with matplotlib.pyplot.imshow:

  • As well as 2D images (greyscale / luminance, using a colormap), it now supports a third dimension for RGB or RGBA channels. For consistency with 2D arrays, missing data is plotted as transparent pixels
  • Being Xarray, users need not care about the order of their dimensions - we infer the right one for color, and warn if it's ambiguous.
  • ~~Using robust=True for easy saturation is really nice. Having it adjust each channel and facet in the same way is essential for this to work, which it does.~~
  • ~~Matplotlib wraps out-of-range colors, leading to crazy maps and serious interpretation problems if it's only a small region. Xarray clips (ie saturates) to the valid range instead.~~

I'm going to implement clip-to-range and color normalization upstream in matplotlib, then open a second PR here so that Xarray can use the same interface.

And that's the commit log! It's not really a big feature, but each of the parts can be fiddly so I've broken the commits up logically 😄

Finally, a motivating example: visible-light Landsat data before, during (top-right), and after a fire at Sampson's Flat, Australia:

arr = ds['red green blue'.split()].to_array(dim='band') / (2 ** 12)
arr.plot.imshow(col='time', col_wrap=5, robust=True)

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

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 16 rows from issue in issue_comments
Powered by Datasette · Queries took 240.694ms · About: xarray-datasette