jaxleyverse / jaxley

Differentiable neuron simulations with biophysical detail on CPU, GPU, or TPU.
https://jaxley.readthedocs.io
Apache License 2.0
46 stars 7 forks source link

Inconsistent use of Dict and **kwargs for plotting functions [Bug] #465

Open fabioseel opened 1 week ago

fabioseel commented 1 week ago

In some places, the additional arguments that should be passed to matplotlibs plotting functions are passed via a dict, sometimes the function interface wants a dict.

For example, running:

import jaxley as jx

comp = jx.Compartment()
comp.compute_xyz()
comp.vis(type="comp", morph_plot_kwargs={"facecolor":'red'})

gives a Type Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "[...]/jaxley/modules/base.py", line 1914, in vis
    return plot_comps(self, dims=dims, ax=ax, col=col, **morph_plot_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: plot_comps() got an unexpected keyword argument 'facecolor'

Either it has to be changed there to comp_plot_kwargs=morph_plot_kwargs or the interface has to change to the **kwargs style.