.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_bar_chart.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_auto_examples_plot_bar_chart.py: Bar chart ========= An example of a bar chart. .. GENERATED FROM PYTHON SOURCE LINES 6-25 .. image-sg:: /auto_examples/images/sphx_glr_plot_bar_chart_001.svg :alt: plot bar chart :srcset: /auto_examples/images/sphx_glr_plot_bar_chart_001.svg :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import niceplots header = ["Method", "Time (sec)"] labels = [ "Analytic Forward", "Analytic Adjoint", "FD Forward Diff.", "FD Central Diff.", "FD Backward Diff.", ] times = [0.00456, 0.00847, 0.0110, 0.0213, 0.011] nd = 4 with plt.style.context(niceplots.get_style()): fig, axes = niceplots.horiz_bar(labels, times, header, nd=nd, size=[7, 0.65]) niceplots.save_figs(fig, "bar_chart", ["png", "svg"]) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.424 seconds) .. _sphx_glr_download_auto_examples_plot_bar_chart.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_bar_chart.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_bar_chart.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_bar_chart.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_