mpl-probscale icon indicating copy to clipboard operation
mpl-probscale copied to clipboard

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

Open hernanrr opened this issue 3 years ago • 2 comments

  • 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'

hernanrr avatar Mar 24 '22 14:03 hernanrr

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

phobson avatar May 17 '22 15:05 phobson

Sure! Although I have no clue how to go about that. Will be fun to learn!

On May 17, 2022, at 11:10 AM, Paul Hobson @.***> wrote:

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

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

hernanrr avatar May 17 '22 20:05 hernanrr