suny-downstate-medical-center / netpyne

A Python package to facilitate the development, parallel simulation, optimization and analysis of multiscale biological neuronal networks in NEURON.
http://www.netpyne.org
MIT License
144 stars 135 forks source link

Bug fix in scalebar - removing the use of the minimumdescent argument in the call to TextArea #828

Closed christian-oreilly closed 2 weeks ago

christian-oreilly commented 1 month ago

Calls to sim.analysis.plotTraces(...) crashes with

Traceback (most recent call last):
  File "/Users/christian/opt/anaconda3/lib/python3.9/site-packages/netpyne/analysis/utils.py", line 87, in wrapper
    return function(*args, **kwargs)
  File "/Users/christian/opt/anaconda3/lib/python3.9/site-packages/netpyne/analysis/traces.py", line 400, in plotTraces
    plotFigPerTrace(cellGids)
  File "/Users/christian/opt/anaconda3/lib/python3.9/site-packages/netpyne/analysis/traces.py", line 317, in plotFigPerTrace
    addScaleBar()
  File "/Users/christian/opt/anaconda3/lib/python3.9/site-packages/netpyne/analysis/traces.py", line 200, in addScaleBar
    add_scalebar(
  File "/Users/christian/opt/anaconda3/lib/python3.9/site-packages/netpyne/support/scalebar.py", line 103, in add_scalebar
    sb = AnchoredScaleBar(ax.transData, **kwargs)
  File "/Users/christian/opt/anaconda3/lib/python3.9/site-packages/netpyne/support/scalebar.py", line 63, in __init__
    self.xlabel = TextArea(labelx, minimumdescent=False)
TypeError: __init__() got an unexpected keyword argument 'minimumdescent'

As per Matplotlib API changes for version 3.4.3::

minimumdescent parameter/property of TextArea

[offsetbox.TextArea](https://matplotlib.org/3.4.3/api/offsetbox_api.html#matplotlib.offsetbox.TextArea) 
has behaved as if minimumdescent was always True (regardless of the value to which it was set) since 
Matplotlib 1.3, so the parameter/property is deprecated.

This argument has been removed from the API of the current version of Matplotlib, causing this code to crash.

vvbragin commented 2 weeks ago

Thanks @christian-oreilly! Merged