Skip to content

Oldest compatible matplotlib version? #114

Description

@mickaellalande

I tried to upgrade ProPlot and install it with conda install -c conda-forge proplot recently and I'm facing to errors every time I'm trying to put a colorbar. Here is the example of the documentation (https://proplot.readthedocs.io/en/latest/colorbars_legends.html#Axes-colorbars-and-legends):

importproplotasplotimportnumpyasnpwithplot.rc.context(abc=True):
f, axs=plot.subplots(ncols=2, share=0)
# Colorbarsax=axs[0]
state=np.random.RandomState(51423)
m=ax.heatmap(state.rand(10, 10), colorbar='t', cmap='dusk')
ax.colorbar(m, loc='r')
ax.colorbar(m, loc='ll', label='colorbar label')
ax.format(title='Axes colorbars', suptitle='Axes colorbars and legends demo')
# Legendsax=axs[1]
ax.format(title='Axes legends', titlepad='0em')
hs=ax.plot(
(state.rand(10, 5) -0.5).cumsum(axis=0), linewidth=3,
cycle='sharp', legend='t',
labels=list('abcde'), legend_kw={'ncols': 5, 'frame': False}
)
ax.legend(hs, loc='r', ncols=1, frame=False)
ax.legend(hs, loc='ll', label='legend label')
axs.format(xlabel='xlabel', ylabel='ylabel')

Here is the error:

---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)
<ipython-input-19-837a2de5d36a>in<module>7ax=axs[0]
8state=np.random.RandomState(51423)
---->9m=ax.heatmap(state.rand(10, 10), colorbar='t', cmap='dusk')
10ax.colorbar(m, loc='r')
11ax.colorbar(m, loc='ll', label='colorbar label')
~/anaconda3/lib/python3.7/site-packages/proplot/axes.pyinheatmap(self, *args, **kwargs)
1208thatissuitableforheatmaps: nogridlines, nominorticks, andmajor1209ticksatthecenterofeachgridbox."""-> 1210 obj = self.pcolormesh(*args, **kwargs) 1211 xlocator, ylocator = None, None 1212 if hasattr(obj, '_coordinates'):~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in _wrapper(self, *args, **kwargs) 2960 @functools.wraps(func) 2961 def _wrapper(self, *args, **kwargs):-> 2962 return driver(self, func, *args, **kwargs) 2963 name = func.__name__ 2964 if name not in proplot_methods:~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in standardize_2d(self, func, order, globe, *args, **kwargs) 650 colorbar_kw = kwargs.pop('colorbar_kw', None) or {} 651 colorbar_kw.setdefault('label', colorbar_label)--> 652 return func(self, x, y, *Zs, colorbar_kw=colorbar_kw, **kwargs) 653  654 ~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in _wrapper(self, *args, **kwargs) 2960 @functools.wraps(func) 2961 def _wrapper(self, *args, **kwargs):-> 2962 return driver(self, func, *args, **kwargs) 2963 name = func.__name__ 2964 if name not in proplot_methods:~/anaconda3/lib/python3.7/site-packages/proplot/wrappers.py in cmap_changer(self, func, cmap, cmap_kw, extend, norm, norm_kw, N, levels, values, centers, vmin, vmax, locator, symmetric, locator_kw, edgefix, labels, labels_kw, fmt, precision, colorbar, colorbar_kw, panel_kw, lw, linewidth, linewidths, ls, linestyle, linestyles, color, colors, edgecolor, edgecolors, *args, **kwargs) 2128 if loc != 'fill': 2129 colorbar_kw.setdefault('loc', loc)-> 2130 self.colorbar(obj, **colorbar_kw) 2131 return obj 2132 ~/anaconda3/lib/python3.7/site-packages/proplot/axes.py in colorbar(self, loc, pad, length, width, space, frame, frameon, alpha, linewidth, edgecolor, facecolor, *args, **kwargs) 944 # Generate panel 945 if loc in ('left', 'right', 'top', 'bottom'):--> 946 ax = self.panel_axes(loc, width=width, space=space, filled=True) 947 return ax.colorbar(loc='_fill', *args, length=length, **kwargs) 948 ~/anaconda3/lib/python3.7/site-packages/proplot/axes.py in panel_axes(self, side, **kwargs) 1370 The panel axes. 1371 """->1372returnself.figure._add_axes_panel(self, side, **kwargs)
13731374 @_standardize_1d~/anaconda3/lib/python3.7/site-packages/proplot/utils.pyindecorator(*args, **kwargs)
61ifBENCHMARK:
62t=time.perf_counter()
--->63res=func(*args, **kwargs)
64ifBENCHMARK:
65decorator.time+= (time.perf_counter() -t)
~/anaconda3/lib/python3.7/site-packages/proplot/subplots.pyin_add_axes_panel(self, ax, side, filled, **kwargs)
858gridspec_prev=self._gridspec_main859gridspec=self._insert_row_column(
-->860side, iratio, width, space, space_orig, figure=False)
861ifgridspecisnotgridspec_prev:
862ifs=='t':
~/anaconda3/lib/python3.7/site-packages/proplot/subplots.pyin_insert_row_column(self, side, idx, ratio, space, space_orig, figure)
1339# May seem inefficient but it literally just assigns a hidden,1340# attribute, and the creation time for subpltospecs is tiny->1341axs= [iaxforaxinself._iter_axes()
1342foriaxin (ax, *ax.child_axes)]
1343foraxinaxs:
~/anaconda3/lib/python3.7/site-packages/proplot/subplots.pyin<listcomp>(.0)
1340# attribute, and the creation time for subpltospecs is tiny1341axs= [iaxforaxinself._iter_axes()
->1342foriaxin (ax, *ax.child_axes)]
1343foraxinaxs:
1344# Get old indexAttributeError: 'XYAxesSubplot'objecthasnoattribute'child_axes'

Here is the version of ProPlot:

# Name Version Build Channel
proplot 0.3.1 py_1 conda-forge

There were no problems in previous versions... This error is the same for any other plots I'm trying to do.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions