PlotWidget

The plot widget provides rudimentary plotting functionality, mostly to demonstrate how plots can be embedded in a Flexx GUI. It may be sufficient for simple cases, but don’t expect it to ever support log-plotting, legends, and other fancy stuff. For real plotting, see e.g. BokehWidget. There might also be a Plotly widget at some point.

Simple example:

p = ui.PlotWidget(xdata=range(5), ydata=[1,3,4,2,5],
                  line_width=4, line_color='red', marker_color='',
                  minsize=200)
open in new tab

Also see examples: sine.py, twente.py, monitor.py.


class flexx.ui.PlotWidget(*init_args, **kwargs)

Inherits from: CanvasWidget

Widget to show a plot of x vs y values. Enough for simple plotting tasks.

properties: line_color, line_width, marker_color, marker_size, xdata, xlabel, ydata, ylabel, yrange

actions: set_data, set_line_color, set_line_width, set_marker_color, set_marker_size, set_xlabel, set_ylabel, set_yrange

line_color

ColorProp – The color of the line. Set to the empty string to hide the line.

line_width

FloatProp – The width of the line, in pixels.

marker_color

ColorProp – The color of the marker. Set to the empty string to hide the marker.

marker_size

FloatProp – The size of the marker, in pixels.

set_data(xdata, ydata)

action – Set the xdata and ydata.

set_line_color(*val)

action – Setter for the ‘line_color’ property.

set_line_width(*val)

action – Setter for the ‘line_width’ property.

set_marker_color(*val)

action – Setter for the ‘marker_color’ property.

set_marker_size(*val)

action – Setter for the ‘marker_size’ property.

set_xlabel(*val)

action – Setter for the ‘xlabel’ property.

set_ylabel(*val)

action – Setter for the ‘ylabel’ property.

set_yrange(*val)

action – Setter for the ‘yrange’ property.

xdata

TupleProp – A list of values for the x-axis. Set via the set_data() action.

xlabel

StringProp – The label to show on the x-axis.

ydata

TupleProp – A list of values for the y-axis. Set via the set_data() action.

ylabel

StringProp – The label to show on the y-axis.

yrange

FloatPairProp – The range for the y-axis. If (0, 0) (default) it is determined from the data.