Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3024b60

Browse filesBrowse files
authored
Merge pull request #29548 from meeseeksmachine/auto-backport-of-pr-29543-on-v3.10.0-doc
Backport PR #29543 on branch v3.10.0-doc (DOC: Minor improvement on broken_barh())
2 parents 22cd63b + bfd73a1 commit 3024b60
Copy full SHA for 3024b60

File tree

1 file changed

+17
-7
lines changed
Filter options

1 file changed

+17
-7
lines changed

‎galleries/examples/lines_bars_and_markers/broken_barh.py

Copy file name to clipboardExpand all lines: galleries/examples/lines_bars_and_markers/broken_barh.py
+17-7Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,30 @@
1919

2020
fig, ax = plt.subplots()
2121
# broken_barh(xranges, (ymin, height))
22-
ax.broken_barh(cpu_1, (5.8, 0.4))
23-
ax.broken_barh(cpu_2, (4.8, 0.4))
24-
ax.broken_barh(cpu_3, (3.8, 0.4))
22+
ax.broken_barh(cpu_1, (-0.2, 0.4))
23+
ax.broken_barh(cpu_2, (0.8, 0.4))
24+
ax.broken_barh(cpu_3, (1.8, 0.4))
2525
ax.broken_barh(cpu_4, (2.8, 0.4))
26-
ax.broken_barh(disk, (1.8, 0.4), color="tab:orange")
27-
ax.broken_barh(network, (0.8, 0.4), color="tab:green")
26+
ax.broken_barh(disk, (3.8, 0.4), color="tab:orange")
27+
ax.broken_barh(network, (4.8, 0.4), color="tab:green")
2828
ax.set_xlim(0, 10)
29-
ax.set_yticks([6, 5, 4, 3, 2, 1],
29+
ax.set_yticks(range(6),
3030
labels=["CPU 1", "CPU 2", "CPU 3", "CPU 4", "disk", "network"])
31+
ax.invert_yaxis()
3132
ax.set_title("Resource usage")
3233

3334
plt.show()
34-
3535
# %%
36+
#
37+
# .. admonition:: References
38+
#
39+
# The use of the following functions, methods, classes and modules is shown
40+
# in this example:
41+
#
42+
# - `matplotlib.axes.Axes.broken_barh` / `matplotlib.pyplot.broken_barh`
43+
# - `matplotlib.axes.Axes.invert_yaxis`
44+
# - `matplotlib.axes.Axes.set_yticks`
45+
#
3646
# .. tags::
3747
#
3848
# component: annotation

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.