question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Panning/zooming a wcs plot broken with (unreleased) Matplotlib 3.1.0

See original GitHub issue

Description

Zooming or panning a plot with a wcs projection is broken with the current master branch of Maptlotlib, that should shortly be released as version 3.1.0. I am aware that this is not the best bug report, but I thought I’d leave it anyway as a placeholder for fixing at some point.

This might be an upstream Maptlotlib issue.

Steps to Reproduce

  1. Install Matplotlib master branch
  2. Run the following code:
from matplotlib import pyplot as plt
from astropy.io import fits
from astropy.wcs import WCS
from astropy.utils.data import get_pkg_data_filename

filename = get_pkg_data_filename('tutorials/FITS-images/HorseHead.fits')

hdu = fits.open(filename)[0]
wcs = WCS(hdu.header)

fig = plt.figure()
fig.add_subplot(111, projection=wcs)
plt.imshow(hdu.data)
plt.show()
  1. Try to zoom/pan

Error message is:

Traceback (most recent call last):
  File "/Users/dstansby/miniconda3/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 743, in array_split
    Ntotal = ary.shape[axis]
AttributeError: 'NoneType' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/cbook/__init__.py", line 216, in process
    func(*args, **kwargs)
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/backend_bases.py", line 2791, in press_pan
    if (x is not None and y is not None and a.in_axes(event) and
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/axes/_base.py", line 2126, in in_axes
    return self.patch.contains(mouseevent)[0]
  File "/Users/dstansby/github/matplotlib/lib/matplotlib/patches.py", line 144, in contains
    Path, np.split(vertices, idxs), np.split(codes, idxs))), {}
  File "/Users/dstansby/miniconda3/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 850, in split
    res = array_split(ary, indices_or_sections, axis)
  File "/Users/dstansby/miniconda3/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 745, in array_split
    Ntotal = len(ary)
TypeError: object of type 'NoneType' has no len()
Traceback (most recent call last):
  File "/Users/dstansby/miniconda3/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 743, in array_split
    Ntotal = ary.shape[axis]
AttributeError: 'NoneType' object has no attribute 'shape'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
dstansbycommented, Apr 21, 2019

Doing a bit of investigating, this bisects to https://github.com/matplotlib/matplotlib/pull/10776 in Matplotlib

1reaction
dstansbycommented, Apr 2, 2019

I’m using the QT5Agg backend.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Activity - QGIS Application - QGIS Issue Tracking
Renders but then crashes when panning/zooming. ... I've tried today to install QGIS 3.2 on mac osx with Python 3.7 new install. No...
Read more >
https://raw.githubusercontent.com/qgis/QGIS/final-...
The good news is that CMake is able to figure out itself which headers need ... Summary The new API makes it available...
Read more >
POLITECNICO DI TORINO Repository ISTITUZIONALE - CORE
Figure 2: Functioning SDI. 1.5 GIS SOFTWARE NEEDS IN SDIS. A Spatial Data Infrastructure should enable the discovery and delivery of spatial ...
Read more >
Thu, 31 Mar 2016 - CRANberries
Description: This is a two-in-one package which provides interfaces to both R and Python. It implements fast hierarchical, ...
Read more >
The Analysis of Open Source Software and Data for ...
Figure 1: Components Of A Spatial Data Infrastructure ... Open Geospatial Consortium Web Coverage Service Interface Standard (WCS) defines Web-based ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found