.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/cascade/plot_customized_cascade.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_cascade_plot_customized_cascade.py: 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 :py:func:`p3analysis.plot.cascade`, the function returns a :py:class:`p3analysis.plot.CascadePlot` object that provides direct access to library internals. When using the :py:mod:`matplotlib` backend it is possible to access the :py:class:`matplotlib.axes.Axes` that were used and subsequently call any number of :py:mod:`matplotlib` functions. In our example, we can use :py:meth:`matplotlib.axes.Axes.set_ylim` to update the y-axis. .. NOTE:: :py:mod:`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 :py:class:`~p3analysis.plot.backend.CascadePlot` object does not provide access to the internals you are looking for, then please `open an issue `_. .. GENERATED FROM PYTHON SOURCE LINES 35-55 .. image-sg:: /examples/cascade/images/sphx_glr_plot_customized_cascade_001.png :alt: plot customized cascade :srcset: /examples/cascade/images/sphx_glr_plot_customized_cascade_001.png :class: sphx-glr-single-img .. code-block:: Python # 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") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.378 seconds) .. _sphx_glr_download_examples_cascade_plot_customized_cascade.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_customized_cascade.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_customized_cascade.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_customized_cascade.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_