Eomys / SciDataTool

SciDataTool is an open-source Python package for scientific data handling. The objective is to provide a user-friendly, unified, flexible module to postprocess any kind of signal. It is meant to be used by researchers, R&D engineers and teachers in any scientific area. This package allows to efficiently store data fields in the time/space or in the frequency domain, to easily perform Fourier Transforms, to extract slices, to convert units, to compare several fields, etc. It therefore leads to simplified plot commands.
Apache License 2.0
26 stars 21 forks source link

Raise exception when performing plot_2D_Data for DataND with one value for requested axis #91

Open EmileDvs opened 2 years ago

EmileDvs commented 2 years ago

The plot_2D_Data is not working if the axis is requested whereas it has only one value. The plot crashes because xlabel and xticks are not initialized if they are None, due to the following code part:

        if (
            axis.extension
            in [
                "whole",
                "interval",
                "oneperiod",
                "antiperiod",
                "smallestperiod",
                "axis_data",
                "list",
            ]
            and len(axis.values) > 1
            or (len(axis.values) == 1 and len(axes_list) == 1)
        )

Maybe it is best to clearly raise an Exception for this case ?