ChrisBeaumont / mpl-modest-image

Friendlier matplotlib interaction with large images
Other
15 stars 9 forks source link

AttributeError: 'AxesSubplot' object has no attribute '_hold' #11

Open nvaytet opened 4 years ago

nvaytet commented 4 years ago

When trying to call imshow with Matplotlib3.0, I get

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-113-7e66688e4419> in <module>
     33 ax = fig.add_subplot(111)
---> 34 im = imshow(ax, z)
     35 cb = plt.colorbar(im)
     36 cb.ax.set_ylabel("Counts")

~/software/miniconda3/lib/python3.7/site-packages/modest_image/modest_image.py in imshow(axes, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
    211     Unlike matplotlib version, must explicitly specify axes
    212     """
--> 213     if not axes._hold:
    214         axes.cla()
    215     if norm is not None:

AttributeError: 'AxesSubplot' object has no attribute '_hold'

Apparently, hold has been removed from Matplotlib: https://stackoverflow.com/questions/53957042/attributeerror-axessubplot-object-has-no-attribute-hold

orena1 commented 3 years ago

This one: https://github.com/ChrisBeaumont/mpl-modest-image/pull/12 Solves your issue.