Skip to content

Commit acadcdb

Browse files
ruthgnRuth Nainggolan
andauthored
Add explanatory comments to "broken" horizontal bar plot example (matplotlib#22030)
* Update broken_barh.py Add explanatory comments for "broken" horizontal bar plot example * Update broken_barh.py Make explanatory comments vertically aligned Co-authored-by: Ruth Nainggolan <[email protected]>
1 parent d48fca9 commit acadcdb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/lines_bars_and_markers/broken_barh.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
"""
88
import matplotlib.pyplot as plt
99

10+
# Horizontal bar plot with gaps
1011
fig, ax = plt.subplots()
1112
ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='tab:blue')
1213
ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9),
1314
facecolors=('tab:orange', 'tab:green', 'tab:red'))
1415
ax.set_ylim(5, 35)
1516
ax.set_xlim(0, 200)
1617
ax.set_xlabel('seconds since start')
17-
ax.set_yticks([15, 25], labels=['Bill', 'Jim'])
18-
ax.grid(True)
18+
ax.set_yticks([15, 25], labels=['Bill', 'Jim']) # Modify y-axis tick labels
19+
ax.grid(True) # Make grid lines visible
1920
ax.annotate('race interrupted', (61, 25),
2021
xytext=(0.8, 0.9), textcoords='axes fraction',
2122
arrowprops=dict(facecolor='black', shrink=0.05),

0 commit comments

Comments
 (0)