Skip to content

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

Description

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions