nschloe/perfplot

feature request: 3D perfplot

Closed this issue · 2 comments

I have a function whose performance is parametrized by 2 variables. I would like to generate a 3D perfplot as either a regular 3D matplotlib chart that I could spin around or slices of that chart in a video (so it would output a video or a gif of charts where each frame is an increase in the second variable).

You can already do that with perfplot, just not automatically. Try something like

objs = []
for param1 in param1_range:
    objs.append(perfplot.bench(
        setup=np.random.rand,
        kernels=[
            lambda a: np.c_[a, a],
            lambda a: np.stack([a, a]).T,
            lambda a: np.vstack([a, a]).T,
        ],
        labels=["c_", "stack", "vstack"],
        n_range=[2 ** k for k in range(25)],
    ))

for obj in objs:
    obj.plot()

This gives you the data and plots for an outer parameter param1. From there you can produce anything you like.

I ended up just generating two perfplots with one of the variables set to it's the maximum and minimum value, and expecting people to infer the values in between, so I can't try this but I appreciate the reply and thanks for this nice library!