niceplots icon indicating copy to clipboard operation
niceplots copied to clipboard

More flexible data input

Open ewu63 opened this issue 4 years ago • 0 comments

Description of feature

Currently, I believe all the data inputted must share the same x value, which is rather limiting. I would like to be able to plot arbitrary x-y pairs (perhaps with an identifier that can be used as a legend item) on subplots.

For example, the following data structure might be able to make two subplots, the top one containing two lines and the bottom one a single line. These subplots share the same x axis/label, but have separate y-axis labels ("Lift" and "Drag"). The user can optionally add legends to the line (e.g. "Composite" or "Metallic").

data = OrderedDict(
    {
        "Lift": [
            {"Time (s)": np.ones(5), "Composite": np.ones(5)},
            {"Time (s)": np.ones(3), "Metallic": np.ones(3)},
        ],
        "Drag": [
            {"Time (s)": np.ones(2), "Composite": np.ones(2)},
        ],
    }
)

Does this make sense? Are there better data formats available? We also want to take care of the simple case where all the lines share the same x values, but maybe it's not too bad to ask the user to provide the same array a bunch of times?

ewu63 avatar Jun 15 '21 04:06 ewu63