Skip to content

Commit 882ba04

Browse files
committed
option to plot using circles rather than bars
1 parent c81918a commit 882ba04

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/scripts/overview_paper/C_impact_of_healthsystem_assumptions/analysis_impact_of_healthsystem.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def find_difference_relative_to_comparison(_ser: pd.Series,
8787
.drop(columns=([comparison] if drop_comparison else [])) \
8888
.stack()
8989

90-
def do_bar_plot_with_ci(_df, annotations=None, xticklabels_horizontal_and_wrapped=False):
90+
def do_bar_plot_with_ci(_df, annotations=None, xticklabels_horizontal_and_wrapped=False, circles=False):
9191
"""Make a vertical bar plot for each row of _df, using the columns to identify the height of the bar and the
9292
extent of the error bar."""
9393
yerr = np.array([
@@ -102,11 +102,14 @@ def do_bar_plot_with_ci(_df, annotations=None, xticklabels_horizontal_and_wrappe
102102
xticks.keys(),
103103
_df['mean'].values,
104104
yerr=yerr,
105-
alpha=0.5,
105+
alpha=0.5 if not circles else 0.0,
106106
ecolor='black',
107107
capsize=10,
108108
label=xticks.values()
109109
)
110+
if circles:
111+
ax.plot(xticks.keys(), _df['mean'].values, marker='o', color='black', markersize=10, linestyle='')
112+
110113
if annotations:
111114
for xpos, ypos, text in zip(xticks.keys(), _df['upper'].values, annotations):
112115
ax.text(xpos, ypos*1.05, text, horizontalalignment='center')
@@ -316,6 +319,7 @@ def rename_scenarios_in_index(ser: pd.Series) -> pd.Series:
316319
for _, row in pc_dalys_averted.clip(lower=0.0).iterrows()
317320
],
318321
xticklabels_horizontal_and_wrapped=True,
322+
circles=True,
319323
)
320324
ax.set_title(name_of_plot)
321325
ax.set_ylim(0, 16)

0 commit comments

Comments
 (0)