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.

Oldest compatible matplotlib version?

See original GitHub issue

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.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
lukelbdcommented, Jan 22, 2020

In the past I avoided this because having to search the conda-forge channel does slow things down compared to defaults, but since they’ve made some performance improvements I decided to do this. Also I like that conda forge is the open source answer to CA’s default channel formulas, and that they have so many packages available.

1reaction
lukelbdcommented, Jan 21, 2020

Ah, thought this might happen! This is related to conda-forge/proplot-feedstock#3.

ProPlot has switched the depencencies from matplotlib-base (only available on the conda-forge channel) to matplotlib (available both on the conda-forge and default channels, and what I expect most people already have installed). I made this change precisely because for most users, the matplotlib-base dependency results in dual installations of matplotlib (as you have), and for some reason often results in conda downloading a really old matplotlib-base.

But either way, version 2.X should not have been installed. I need to precisely figure out the oldest compatible version of matplotlib (i.e. the dependencies should be something like matplotlib>=3.0.0 or matplotlib-base>=3.0.0 instead of just matplotlib and matplotlib-base) and update the existing conda forge builds. Will leave this open until I get around to it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Minimum version of dependencies policy - Matplotlib
We will only bump these dependencies as we need new features or the old versions no longer support our minimum NumPy or Python....
Read more >
Installation Guide — Matplotlib 3.3.3 documentation
You are reading an old version of the documentation (v3.3.3). For the latest version see https://matplotlib.org/stable/users/installing.html.
Read more >
Installing — Matplotlib 2.0.2 documentation
The first option is to use one of the pre-packaged python distributions that already provide matplotlib built-in. The Continuum.io Python distribution (Anaconda ...
Read more >
Installing — Matplotlib 3.1.2 documentation
You are reading an old version of the documentation (v3.1.1). For the latest version see https://matplotlib.org/stable/users/installing.html.
Read more >
Installing — Matplotlib 2.1.0 documentation
On extremely old versions of Linux and Python 2.7 you may need to install the master version of subprocess32 (see comments).
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