triqs.plot.protocol

Definition of the TRIQS plot protocol.

The plot protocol is the convention TRIQS objects use to describe themselves to a plotting backend (typically triqs.plot.mpl_interface). An object supports the protocol if it satisfies one of:

  • it has a method _plot_(opt_dict) returning a list of curve dictionaries, or

  • its type is registered in plot_function_table, mapping to a free function f(obj, opt_dict) returning the same.

Each returned curve dictionary holds the keyword arguments forwarded to matplotlib by oplot(): at minimum xdata and ydata, and optionally label, plot_function ('plot', 'bar', …), xlabel, ylabel, title, xticks, zdata, legend, plus any line-property kwargs.

Functions

clip_array(x_array, x_min, x_max)

Return the slice selecting entries of an ordered array within a window.

plot_protocol_apply(ob, opt_dict, xlims)

Apply the plot protocol to an arbitrary object.

Module Attributes

plot_function_table

dict : Registry mapping type to a plot-protocol function.