From 3ad40b305d361cac7e6a511088e25e57434e39f0 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 10 Aug 2022 10:10:31 +0100 Subject: [PATCH 1/2] feat(interactive-plot): use gl variant for performance https://plotly.com/python/webgl-vs-svg/ --- pyneuroml/plot/Plot.py | 2 +- tests/plot/test_plot.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyneuroml/plot/Plot.py b/pyneuroml/plot/Plot.py index 45620b41..1097e2ee 100644 --- a/pyneuroml/plot/Plot.py +++ b/pyneuroml/plot/Plot.py @@ -374,7 +374,7 @@ def generate_interactive_plot( for i in range(len(xvalues)): fig.add_trace( - go.Scatter( + go.Scattergl( x=xvalues[i], y=yvalues[i], name=labels[i], diff --git a/tests/plot/test_plot.py b/tests/plot/test_plot.py index 0763b616..21ff6955 100644 --- a/tests/plot/test_plot.py +++ b/tests/plot/test_plot.py @@ -64,10 +64,10 @@ def test_generate_interactive_plot(self): except FileNotFoundError: pass - xs = [*range(5, 15)] - ys = [*range(5, 15)] - xs1 = [*range(5, 15)] - ys1 = [*range(14, 4, -1)] + xs = [*range(5, 1500)] + ys = [*range(5, 1500)] + xs1 = [*range(5, 1500)] + ys1 = [*range(1499, 4, -1)] labels = ["up", "down"] generate_interactive_plot( xvalues=[xs, xs1], @@ -78,7 +78,7 @@ def test_generate_interactive_plot(self): plot_bgcolor="white", xaxis="x axis", yaxis="y axis", - show_interactive=False, + show_interactive=True, xaxis_spikelines=True, yaxis_spikelines=False, save_figure_to=filename, From 39e791bdbc75c9a2f1dc7f5e56e5e1fac52c6c54 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 10 Aug 2022 10:11:07 +0100 Subject: [PATCH 2/2] test(plot): add more points to test performance --- tests/plot/test_plot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/plot/test_plot.py b/tests/plot/test_plot.py index 21ff6955..f51bb184 100644 --- a/tests/plot/test_plot.py +++ b/tests/plot/test_plot.py @@ -64,17 +64,17 @@ def test_generate_interactive_plot(self): except FileNotFoundError: pass - xs = [*range(5, 1500)] - ys = [*range(5, 1500)] - xs1 = [*range(5, 1500)] - ys1 = [*range(1499, 4, -1)] + xs = [*range(5, 15000)] + ys = [*range(5, 15000)] + xs1 = [*range(5, 15000)] + ys1 = [*range(14999, 4, -1)] labels = ["up", "down"] generate_interactive_plot( xvalues=[xs, xs1], yvalues=[ys, ys1], labels=labels, modes=["lines+markers", "markers"], - title="test interactive plot", + title=f"test interactive plot with {len(xs) * 2} points", plot_bgcolor="white", xaxis="x axis", yaxis="y axis",