diff --git a/galleries/examples/lines_bars_and_markers/broken_barh.py b/galleries/examples/lines_bars_and_markers/broken_barh.py index c400c67cffe4..3714ca7c748d 100644 --- a/galleries/examples/lines_bars_and_markers/broken_barh.py +++ b/galleries/examples/lines_bars_and_markers/broken_barh.py @@ -19,20 +19,30 @@ fig, ax = plt.subplots() # broken_barh(xranges, (ymin, height)) -ax.broken_barh(cpu_1, (5.8, 0.4)) -ax.broken_barh(cpu_2, (4.8, 0.4)) -ax.broken_barh(cpu_3, (3.8, 0.4)) +ax.broken_barh(cpu_1, (-0.2, 0.4)) +ax.broken_barh(cpu_2, (0.8, 0.4)) +ax.broken_barh(cpu_3, (1.8, 0.4)) ax.broken_barh(cpu_4, (2.8, 0.4)) -ax.broken_barh(disk, (1.8, 0.4), color="tab:orange") -ax.broken_barh(network, (0.8, 0.4), color="tab:green") +ax.broken_barh(disk, (3.8, 0.4), color="tab:orange") +ax.broken_barh(network, (4.8, 0.4), color="tab:green") ax.set_xlim(0, 10) -ax.set_yticks([6, 5, 4, 3, 2, 1], +ax.set_yticks(range(6), labels=["CPU 1", "CPU 2", "CPU 3", "CPU 4", "disk", "network"]) +ax.invert_yaxis() ax.set_title("Resource usage") plt.show() - # %% +# +# .. admonition:: References +# +# The use of the following functions, methods, classes and modules is shown +# in this example: +# +# - `matplotlib.axes.Axes.broken_barh` / `matplotlib.pyplot.broken_barh` +# - `matplotlib.axes.Axes.invert_yaxis` +# - `matplotlib.axes.Axes.set_yticks` +# # .. tags:: # # component: annotation