Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proplot throws errors after upgrade #349

Closed
dawnstrata opened this issue Mar 14, 2022 · 3 comments
Closed

proplot throws errors after upgrade #349

dawnstrata opened this issue Mar 14, 2022 · 3 comments

Comments

@dawnstrata
Copy link

dawnstrata commented Mar 14, 2022

Description

After upgrading proplot, I get errors when trying to do some simple things. The main issue is encountered upon making panels. The panel displays in output but with an error. Would really appreciate advice on how to fix this! I have looked at some previous posts here and have already tried updating matplotlib and proplot together, with no change in behavior.

Steps to reproduce

import proplot as plot

import numpy as np

fig, axs = plot.subplots(axwidth=5, ncols=1, nrows=1)
a = axs.plot(np.linspace(0,100,100), np.linspace(0,100,100), '--', c='sapphire', label='Ni')
axs.panel(side='b')

Expected behavior

A plot featuring a line, with an empty panel beneath it.

Actual behavior:

Throws following error:

AttributeError                            Traceback (most recent call last)
<ipython-input-14-c30176304eae> in <module>
      3 fig, axs = plot.subplots(axwidth=5, ncols=1, nrows=1, share=0)
      4 
----> 5 axs.panel(side='b', space=0.15)

~/opt/anaconda3/lib/python3.7/site-packages/proplot/gridspec.py in _grid_command(self, *args, **kwargs)
   1456         objs = []
   1457         for ax in self:
-> 1458             obj = getattr(ax, name)(*args, **kwargs)
   1459             objs.append(obj)
   1460         return SubplotGrid(objs)

~/opt/anaconda3/lib/python3.7/site-packages/proplot/axes/base.py in panel(self, *args, **kwargs)
   1657         %(axes.panel)s
   1658         """
-> 1659         return self.panel_axes(*args, **kwargs)
   1660 
   1661     @docstring._snippet_manager

~/opt/anaconda3/lib/python3.7/site-packages/proplot/axes/base.py in panel_axes(self, *args, **kwargs)
   1670         if self._panel_parent:
   1671             raise RuntimeError('Cannot create panels for existing panel axes.')
-> 1672         return self.figure._add_axes_panel(self, *args, **kwargs)
   1673 
   1674     def _add_frame(

~/opt/anaconda3/lib/python3.7/site-packages/proplot/figure.py in _add_axes_panel(self, ax, side, **kwargs)
    910         pax._panel_parent = ax
    911         ax._panel_dict[side].append(pax)
--> 912         ax._auto_share()
    913         axis = pax.yaxis if side in ('left', 'right') else pax.xaxis
    914         getattr(axis, 'tick_' + side)()  # set tick and tick label position

~/opt/anaconda3/lib/python3.7/site-packages/proplot/axes/base.py in _auto_share(self)
   1747                 for iax in (self, *paxs[:-1]):
   1748                     iax._panel_sharex_group = True
-> 1749                     iax._sharex_setup(bottom)  # parent is bottom-most
   1750             paxs = shared(self._panel_dict['top'])
   1751             for iax in paxs:

~/opt/anaconda3/lib/python3.7/site-packages/proplot/axes/cartesian.py in _sharex_setup(self, sharex, labels, limits)
    583         # labels. But this is done after the fact -- tickers are still shared.
    584         if level > 1 and limits:
--> 585             self._sharex_limits(sharex)
    586 
    587     def _sharey_setup(self, sharey, *, labels=True, limits=True):

~/opt/anaconda3/lib/python3.7/site-packages/proplot/axes/cartesian.py in _sharex_limits(self, sharex)
    524                 ax1.set_xlim(ax2.get_xlim())  # non-default limits
    525         # Copy non-default locators and formatters
--> 526         self._shared_x_axes.join(self, sharex)  # share limit/scale changes
    527         if sharex.xaxis.isDefault_majloc and not self.xaxis.isDefault_majloc:
    528             sharex.xaxis.set_major_locator(self.xaxis.get_major_locator())

AttributeError: 'CartesianAxesSubplot' object has no attribute '_shared_x_axes'

Proplot version

3.5.1
0.9.5

@lukelbd
Copy link
Collaborator

lukelbd commented Mar 14, 2022

Sorry, for now you'll have to downgrade to matplotlib < 3.5.0 (see #309). So try pip install matplotlib==3.4.3. Have been busy lately but hoping to get a 3.5.0 compatibility release out by the end of the year.

@lukelbd
Copy link
Collaborator

lukelbd commented Mar 14, 2022

Alternatively you can install the development version with pip install git+https://github.com/lukelbd/proplot.git, which is compatible with matplotlib 3.5 (there's just a couple other things I want to include in the release, namely #325).

@dawnstrata
Copy link
Author

No problem - that did indeed make it work again. Love proplot - keep up the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants