Bar chart

An example of a bar chart.

plot bar chart
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"])

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

Gallery generated by Sphinx-Gallery