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

Unexpected keyword argument 'basex' when following the Getting Started base-2 log scale example #82

Open
hernanrr opened this issue Mar 24, 2022 · 2 comments

Comments

@hernanrr
Copy link

  • Python version: Python 3.10.1 (v3.10.1:2cd268a3a9, Dec 6 2021, 14:28:59)
  • Numpy Version: 1.21.5
  • matplotlib version 3.5.1:
  • mpl-probscale version: 0.2.3
  • Operating System: macOS Moterrey Version 12.2.1

Description

Working through the Getting Started section, on the second example with base-2 log scales, I get the following error:

TypeError: LogScale.__init__() got an unexpected keyword argument 'basex'

Changing basex to base resolves the issue.

What I Did

import numpy
from matplotlib import pyplot as plt
from scipy import stats
import seaborn

clear_bkgd = {'axes.facecolor': 'none', 'figure.facecolor': 'none'}
seaborn.set(style='ticks', context='talk', color_codes=True, rc=clear_bkgd)

fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(8, 3))
ax1.set_xscale('log')
ax1.set_xlim(left=1e-3, right=1e3)
ax1.set_xlabel("Base 10")
ax1.set_yticks([])

ax2.set_xscale('log', basex=2)
ax2.set_xlim(left=2**-3, right=2**3)
ax2.set_xlabel("Base 2")
ax2.set_yticks([])

seaborn.despine(fig=fig, left=True)

plt.show()

Traceback:

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ricardo/Documents/Sandbox/Python/probscale_examples.py", line 17, in <module>
    ax2.set_xscale('log', basex=2)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 3777, in set_xscale
    ax.xaxis._set_scale(value, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/axis.py", line 761, in _set_scale
    self._scale = mscale.scale_factory(value, self, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/scale.py", line 597, in scale_factory
    return scale_cls(axis, **kwargs)
TypeError: LogScale.__init__() got an unexpected keyword argument 'basex'
@phobson
Copy link
Member

phobson commented May 17, 2022

Thanks for the report. Any interest in submitting a PR to fix the documentation?

@hernanrr
Copy link
Author

hernanrr commented May 17, 2022 via email

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

No branches or pull requests

2 participants