Skip to content

Flint: Clean up around custom plots

Closes #2051 (closed), #2143 (closed)

This MR clean up stuffs around the custom plot API.

The aim is to make the API a bit more consistent, maintainable, and make sure we will not have further regressions.

As a lot of small things were changed, this could introduce small regressions here and there.

  • Update of the user documentation
  • Coverage of the user plots including deprecated methods
  • Added a new API for the curve plot (see bellow)
  • Small tune of the widget used to hold the plots
  • Lot of small fixes around the user API

The new curve plot API:

# Create the data
t = numpy.linspace(0, 10 * numpy.pi, 100)
s1 = numpy.sin(t)
s2 = numpy.sin(t + numpy.pi * 0.5)
s3 = numpy.sin(t + numpy.pi * 1.0)
s4 = numpy.sin(t + numpy.pi * 1.5)

# -----------------------

# Create the plot
f = flint()
p = f.get_plot("curve", name="My plot", unique_name="myplot")

# Describe the plot
p.add_curve_item("t", "s1", color="pink")
p.add_curve_item("t", "s2", color="green")
p.add_curve_item("t", "s3", color="blue")
p.add_curve_item("t", "s4")

...

# Transfer the data, which update the plot
p.set_data(t=t, s1=s1, s2=s2, s3=s3, s4=s4)
Edited by Valentin Valls

Merge request reports