matplotlib / matplotlib/mpl-probscale
Unexpected keyword argument 'basex' when following the Getting Started base-2 log scale example
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
- 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'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the Getting Started section at the linked built-in Matplotlib scales example and compare the base-2 example with the reported Matplotlib error. Update the outdated keyword and verify that the example runs without the unexpected-keyword exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100