Customized CascadeΒΆ

A customized cascade plot.

In this example, we show how to customize a cascade plot by changing the limits of the y-axis. Although the default limit (of 1) is useful for comparing many plots side-by-side, in practice it is often useful to be able to zoom-in on specific regions of data. For example, when dealing with applications that do not achieve very high levels of architectural efficiency, setting a lower maximum value for the y-axis can improve readability.

Instead of trying to expose all possible customization options as arguments to p3analysis.plot.cascade(), the function returns a p3analysis.plot.CascadePlot object that provides direct access to library internals. When using the matplotlib backend it is possible to access the matplotlib.axes.Axes that were used and subsequently call any number of matplotlib functions. In our example, we can use matplotlib.axes.Axes.set_ylim() to update the y-axis.

Note

matplotlib is currently the only backend supported by the P3 Analysis Library, but this is subject to change.

Tip

If you have any trouble customizing a plot, or the CascadePlot object does not provide access to the internals you are looking for, then please open an issue.

plot customized cascade
# Initialize synthetic performance efficiency data
# (not shown, but available in script download)

# Read performance efficiency data into pandas DataFrame
df = pd.DataFrame(data)

# Generate a cascade plot with custom style options
legend = p3analysis.plot.Legend(loc="center left", bbox_to_anchor=(0.91, 0.225), ncols=2)
pstyle = p3analysis.plot.PlatformStyle(colors="GnBu")
astyle = p3analysis.plot.ApplicationStyle(markers=["x", "s", "p", "h", "H", "v"])
cascade = p3analysis.plot.cascade(df, size=(6, 5), platform_legend=legend, platform_style=pstyle, application_style=astyle)

# Further customize the cascade plot using matplotlib
# In this example, we adjust the range of the y-axis to improve readability
# This may be necessary for studies using architectural efficiency
cascade.get_axes("eff").set_ylim([0, 0.12])
cascade.get_axes("pp").set_ylim([0, 0.12])

cascade.save("customized-cascade.png")

Total running time of the script: (0 minutes 0.378 seconds)

Gallery generated by Sphinx-Gallery