Open wtbarnes opened 1 year ago
Hi @wtbarnes. Thanks for raising this issue. I would class it as a bug. After a quick glance I think this should be fixed simply by extracting user input coord_params
and updating the auto-generated ones before line 195 of mpl_plotter.py
, e.g.
user_coord_params = kwargs.pop("coord_params")
coord_params.update(user_coord_params)
A test should be added to ensure this works. Would you be interested in opening a PR to fix implement this change?
Sure! That seems like a reasonable solution. Re: the added test, should that be a figure test?
Yes, I think if possible this should be a figure test. I'm not that expert on figure tests when the output is an animation. Perhaps you can compare with any other such tests in ndcube or ask @Cadair.
Describe the bug
When plotting a cube with a number of dimensions higher than 2, the result of
.plot()
is an animation on the additional axes and is handled bympl_animators
.ArrayAnimatorWCS
can take a dictionarycoord_params
that can be used to apply parameters to axeslabels, ticklabels, etc. However, when I pass this dict through.plot
, I get the exception shown below. This seems to be becausendcube
is supplying its owncoord_params
, but is not accounting for a user-specifiedcoord_params
:https://github.com/sunpy/ndcube/blob/481510bb683fc359c4e39ad8b42a89de8e9d68b7/ndcube/visualization/mpl_plotter.py#L193-L194
If a user specifies
coord_params
, both are passed tompl-animators
, leading to the exception below.If this is not a bug, but rather a feature request, feel free to relabel. I did assume this would work though because the
.plot
docstring says,https://docs.sunpy.org/projects/ndcube/en/stable/api/ndcube.visualization.mpl_plotter.MatplotlibPlotter.html#ndcube.visualization.mpl_plotter.MatplotlibPlotter.plot
To Reproduce
throws the following exception
Screenshots
No response
System Details
Installation method
pip