PySpice icon indicating copy to clipboard operation
PySpice copied to clipboard

Deprecated semilogx argument in bode_plot for matplotlib >= 3.3.0

Open carmelom opened this issue 3 years ago • 1 comments

Environment (OS, Python version, PySpice version, simulator)

Windows 10, Python 3.8.8, PySpice v1.5, ngspice

Expected Behaviour

After installing PySpice and ngspice simulator, the provided example on RC filters should run to the end

https://pyspice.fabrice-salvaire.fr/releases/v1.4/examples/filter/low-pass-rc-filter.html

Actual Behaviour

bode_diagram fails with [TypeError: __init__() got an unexpected keyword argument 'basex']() from calling ax.semilogx. This is related to the deprecated argument in later versions of matplotlib

https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.3.0.html?highlight=basex#log-symlog-scale-base-ticks-and-nonpos-specification

carmelom avatar Mar 11 '22 09:03 carmelom

I also ran into this issue. Following the matplotlib changelog, the fix is straightforward: replace "basex" with "base" in PySpice/Plot/BodeDiagram.py. There are 2 occurrences:

def bode_diagram_gain(axe, frequency, gain, **kwargs):
    axe.semilogx(frequency, gain, base=10, **kwargs)
...
def bode_diagram_phase(axe, frequency, phase, **kwargs):
    axe.semilogx(frequency, phase, base=10, **kwargs)

banjaxedben avatar May 16 '22 16:05 banjaxedben