From 0eba9e46618db27fa6fc0667b8fc751b0b845205 Mon Sep 17 00:00:00 2001 From: Ruth Nainggolan Date: Tue, 21 Dec 2021 16:40:43 -0500 Subject: [PATCH 1/2] Update broken_barh.py Add explanatory comments for "broken" horizontal bar plot example --- examples/lines_bars_and_markers/broken_barh.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/lines_bars_and_markers/broken_barh.py b/examples/lines_bars_and_markers/broken_barh.py index 084e0aae9ecb..dd6b5fcd69b4 100644 --- a/examples/lines_bars_and_markers/broken_barh.py +++ b/examples/lines_bars_and_markers/broken_barh.py @@ -7,6 +7,7 @@ """ import matplotlib.pyplot as plt +# Horizontal bar plot with gaps fig, ax = plt.subplots() ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='tab:blue') ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9), @@ -14,8 +15,8 @@ ax.set_ylim(5, 35) ax.set_xlim(0, 200) ax.set_xlabel('seconds since start') -ax.set_yticks([15, 25], labels=['Bill', 'Jim']) -ax.grid(True) +ax.set_yticks([15, 25], labels=['Bill', 'Jim']) # Modify y-axis tick labels +ax.grid(True) # Make grid lines visible ax.annotate('race interrupted', (61, 25), xytext=(0.8, 0.9), textcoords='axes fraction', arrowprops=dict(facecolor='black', shrink=0.05), From f7602dd5fe5e3b59eeabe143aa20bd1759435bbc Mon Sep 17 00:00:00 2001 From: Ruth Nainggolan Date: Tue, 21 Dec 2021 17:52:52 -0500 Subject: [PATCH 2/2] Update broken_barh.py Make explanatory comments vertically aligned --- examples/lines_bars_and_markers/broken_barh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/lines_bars_and_markers/broken_barh.py b/examples/lines_bars_and_markers/broken_barh.py index dd6b5fcd69b4..6da38f1e465f 100644 --- a/examples/lines_bars_and_markers/broken_barh.py +++ b/examples/lines_bars_and_markers/broken_barh.py @@ -15,8 +15,8 @@ ax.set_ylim(5, 35) ax.set_xlim(0, 200) ax.set_xlabel('seconds since start') -ax.set_yticks([15, 25], labels=['Bill', 'Jim']) # Modify y-axis tick labels -ax.grid(True) # Make grid lines visible +ax.set_yticks([15, 25], labels=['Bill', 'Jim']) # Modify y-axis tick labels +ax.grid(True) # Make grid lines visible ax.annotate('race interrupted', (61, 25), xytext=(0.8, 0.9), textcoords='axes fraction', arrowprops=dict(facecolor='black', shrink=0.05),