pyopus.plotter.evalplotter — A PyQt5 and Matplotlib based simulation results plotter¶
A PyQt and Matplotlib based simulation results plotter (PyOPUS subsystem name: EvalPl)
This plotter takes the simulation results from a
Because this plotter depends on PyQt5 and Matplotlib it is not imported into the main PyOPUS module.
The plot windows and their contents are described by a dictionary with the following keys:
graphs- lists the plot windows and their axes
styles- lists the style masks for traces
traces- lists the traces that will be displayed on the axes of plot windows
The value of
graphs is a dictionary with graph name for key. The value
for every key is a dictionary describing a graph with the following members:
title- the title of the canvas displaying the graph
shape- a dictionary specifying the size of the plot window. It has the following members:
figsize- a tuple giving the horizontal and vertical size of the plot window in inches
figpx- a tuple giving the horizontal and vertical size of the plot window in pixels
dpi- a number specifying the dots-per-inch value for the plot window This value is used for converting
figsizeto pixels when the plot window is displayed on the screen.
figpxtakes precedence over
dpiis used for calculating the size of the figure in inches (used when a plot window is saved to a Postscript file).
figpxis not specified,
dpiis used for convertion
figsizeto pixels. The obtained values specify the size of the plot window’s canvas.
dpiis not specified the default Matplotlib value is used.
The contents of the
shapedictionary are passed to the constructor of the
QPFigureCanvasobject that corresponds to the plot window.
axes- a dictionary with axes name for key decribing the axes that reside in the plot window
Every value in the
axesdictionary describes one axes of the plot window. It is itself a dictionary with the following members:
subplot- the subplot specification (tuple of 3 integers) passed to the
add_subplot()method of the plot window at axes creation
rectangle- the rectangle specification (tuple of 4 integers) passed to the
add_axes()method of the plot window at axes creation
options- a dictionary of keyword arguments passed to the method that creates the axes
gridtype- type of grid for the axes.
rectfor rectilinear (default) or
polarfor polar grid.
xscale- a dictionary describing the type of the x-axis scale
yscale- a dictionary describing the type of the y-axis scale
xlimits- a tuple with two values specifying the lower and the upper limit for the x-axis scale
ylimits- a tuple with two values specifying the lower and the upper limit for the y-axis scale
xlabel- the label for the x-axis
ylabel- the label for the y-axis
title- the title for the axes
legend- a boolean flag indicating if legend should be displayed.
grid- a boolean flag indicating if gridlines should be displayed.
Falseby default. `
Axis scale type (
yscale) is a dictionary with the following members:
type- type of scale (
symlog). Default is
base- the base for the log scale (default is 10).
subticks- an array of log scale subticks (for base 10 this is
linthresh- linearity threshold for the
symlogtype of scale
Axes.set_yscale()methods in Matplotlib for more information.
The value of
styles is a list of dictionaries. Every dictionary specifyes
a style with the following dictionary members:
pattern- a tuple of 4 regular expressions for matching a trace to a style. The first member of the tuple matches the graph name, the second one matches the axes name, the third matches the corner name and the fourth matches the trace name. See the
restandard Python module for the explanation of regular expressions.
style- a dictionary specifying style directives. Members of this dictionary are keyword arguments to the
plot()method of the axes.
A trace style is determined by starting with no style directives. The
styles list is traveversed and a style specified by the
member is applied if the
pattern matches the graph, axes, corner, and
Style directives that appear later in the list override those that appear
earlier. The final trace style is obtained by applying the
in the trace definition. This style overrides the style directives obtained
patterns from the
traces member is a dictionary with trace name for key. Values are
dictionaries with the following members:
graph- the name of the plot window in which the trace will appear
axes- the name of the axes in the plot window where trace will appear
xresult- the name of the performance measure in the
PerformanceEvaluatorobject that is used for x-axis values
yresult- the name of the performance measure in the
PerformanceEvaluatorobject that is used for y-axis values
corners- a list of corners for which the trace will be plotted. If ommitted the trace is plotted for all corners in which the
style- a dictionary specifying the style directives (keyword arguments to the
plot()method of the axes)
EvalPlotter(setup, performanceEvaluator, debug=0)¶
A class that plots the peformance measures from the perforamnceEvaluator object.
The way these measures are plotted is specified by setup.
If debug is greater than 0 debug messages are printed at standard output.
Objects of this class are callable with the following calling convention:
object(prefixText='', postfixText='', createPlots=True)
The title of every plot windows is the plot window name.
The title of every canvas is composed of prefixText, plot window title, and postfixText.
The createPlots is
Truethe plot windows are created if they do not exist. If a plot window does not exist and it is not created then the traces that are supposed to be displayed by that plot window are not plotted.
Returns the performance evaluator object specified when the plotter’s constructor was called.