proplot icon indicating copy to clipboard operation
proplot copied to clipboard

AttributeError when running example

Open pulkin opened this issue 3 years ago • 1 comments

Description

AttributeError: 'CartesianAxesSubplot' object has no attribute '_shared_y_axes'. Did you mean: '_shared_axes'?

Steps to reproduce

python -m venv venv
source venv/bin/activate
pip install proplot
python test.py

Installed versions

Collecting proplot
  Using cached proplot-0.9.5-py3-none-any.whl (8.0 MB)
Collecting matplotlib
  Using cached matplotlib-3.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.9 MB)
Collecting packaging>=20.0
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting pillow>=6.2.0
  Using cached Pillow-9.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
Collecting fonttools>=4.22.0
  Using cached fonttools-4.33.3-py3-none-any.whl (930 kB)
Collecting pyparsing>=2.2.1
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting cycler>=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting numpy>=1.17
  Using cached numpy-1.23.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.0 MB)
Collecting python-dateutil>=2.7
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.4.3-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.6 MB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, pyparsing, python-dateutil, pillow, packaging, numpy, kiwisolver, fonttools, cycler, matplotlib, proplot
Successfully installed cycler-0.11.0 fonttools-4.33.3 kiwisolver-1.4.3 matplotlib-3.5.2 numpy-1.23.0 packaging-21.3 pillow-9.1.1 proplot-0.9.5 pyparsing-3.0.9 python-dateutil-2.8.2 six-1.16.0

test.py from here (copy-paste)

import proplot as pplt
fig = pplt.figure(space=0, refwidth='10em')
axs = fig.subplots(nrows=3, ncols=3)
axs.format(
    abc='A.', abcloc='ul',
    xticks='null', yticks='null', facecolor='gray5',
    xlabel='x axis', ylabel='y axis',
    suptitle='A-b-c label offsetting, borders, and boxes',
)
axs[:3].format(abcloc='l', titleloc='l', title='Title')
axs[-3:].format(abcbbox=True)  # also disables abcborder
# axs[:-3].format(abcborder=True)  # this is already the default

Error


/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/__init__.py:71: ProplotWarning: Rebuilding font cache. This usually happens after installing or updating proplot.
  register_fonts(default=True)
Traceback (most recent call last):
  File "/home/pulkin/TEMP/test.py", line 3, in <module>
    axs = fig.subplots(nrows=3, ncols=3)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/figure.py", line 1372, in subplots
    return self.add_subplots(*args, **kwargs)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/figure.py", line 1362, in add_subplots
    axs[idx] = self.add_subplot(ss, **kw)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/figure.py", line 1248, in add_subplot
    ax = super().add_subplot(ss, _subplot_spec=ss, **kwargs)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/matplotlib/figure.py", line 772, in add_subplot
    ax = subplot_class_factory(projection_class)(self, *args, **pkw)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/matplotlib/axes/_subplots.py", line 34, in __init__
    self._axes_class.__init__(self, fig, [0, 0, 1, 1], **kwargs)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/axes/cartesian.py", line 338, in __init__
    super().__init__(*args, **kwargs)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/axes/plot.py", line 1260, in __init__
    super().__init__(*args, **kwargs)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/axes/base.py", line 783, in __init__
    self._auto_share()
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/axes/base.py", line 1777, in _auto_share
    child._sharey_setup(parent)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/axes/cartesian.py", line 605, in _sharey_setup
    self._sharey_limits(sharey)
  File "/home/pulkin/TEMP/venv/lib64/python3.10/site-packages/proplot/axes/cartesian.py", line 548, in _sharey_limits
    self._shared_y_axes.join(self, sharey)  # share limit/scale changes
AttributeError: 'CartesianAxesSubplot' object has no attribute '_shared_y_axes'. Did you mean: '_shared_axes'?

pulkin avatar Jul 01 '22 12:07 pulkin

#309 but still unusable

pulkin avatar Jul 01 '22 12:07 pulkin

See #309 -- installing the latest proplot release (v0.9.7) will enforce compatible numpy and matplotlib versions.

lukelbd avatar Mar 29 '23 00:03 lukelbd