-
Notifications
You must be signed in to change notification settings - Fork 98
Closed
Labels
Milestone
Description
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):
import proplot as plot
import numpy as np
with plot.rc.context(abc=True):
f, axs = plot.subplots(ncols=2, share=0)
# Colorbars
ax = 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')
# Legends
ax = 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:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-837a2de5d36a> in <module>
7 ax = axs[0]
8 state = np.random.RandomState(51423)
----> 9 m = ax.heatmap(state.rand(10, 10), colorbar='t', cmap='dusk')
10 ax.colorbar(m, loc='r')
11 ax.colorbar(m, loc='ll', label='colorbar label')
~/anaconda3/lib/python3.7/site-packages/proplot/axes.py in heatmap(self, *args, **kwargs)
1208 that is suitable for heatmaps: no gridlines, no minor ticks, and major
1209 ticks at the center of each grid box."""
-> 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 """
-> 1372 return self.figure._add_axes_panel(self, side, **kwargs)
1373
1374 @_standardize_1d
~/anaconda3/lib/python3.7/site-packages/proplot/utils.py in decorator(*args, **kwargs)
61 if BENCHMARK:
62 t = time.perf_counter()
---> 63 res = func(*args, **kwargs)
64 if BENCHMARK:
65 decorator.time += (time.perf_counter() - t)
~/anaconda3/lib/python3.7/site-packages/proplot/subplots.py in _add_axes_panel(self, ax, side, filled, **kwargs)
858 gridspec_prev = self._gridspec_main
859 gridspec = self._insert_row_column(
--> 860 side, iratio, width, space, space_orig, figure=False)
861 if gridspec is not gridspec_prev:
862 if s == 't':
~/anaconda3/lib/python3.7/site-packages/proplot/subplots.py in _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
-> 1341 axs = [iax for ax in self._iter_axes()
1342 for iax in (ax, *ax.child_axes)]
1343 for ax in axs:
~/anaconda3/lib/python3.7/site-packages/proplot/subplots.py in <listcomp>(.0)
1340 # attribute, and the creation time for subpltospecs is tiny
1341 axs = [iax for ax in self._iter_axes()
-> 1342 for iax in (ax, *ax.child_axes)]
1343 for ax in axs:
1344 # Get old index
AttributeError: 'XYAxesSubplot' object has no attribute '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.