Skip to content

Commit b0369b1

Browse files
committed
Switch bars positions based on the sign of the contribution
1 parent 31f28e1 commit b0369b1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/ert/gui/plotting/ert_plots/waterfall.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,16 @@ def _plot_waterfall(
140140
width=0.7,
141141
)
142142

143-
# Connector lines between bars
143+
# Connector lines between bars, at the running total after each bar
144+
# (bottom of bar for negative contributions, top otherwise)
144145
for i in range(n_bars - 1):
145-
top_i = bottoms[i] + heights[i]
146+
if types[i] == "contribution" and values[i] < 0:
147+
level_i = bottoms[i]
148+
else:
149+
level_i = bottoms[i] + heights[i]
146150
ax.plot(
147151
[x[i] + 0.35, x[i + 1] - 0.35],
148-
[top_i, top_i],
152+
[level_i, level_i],
149153
color="grey",
150154
linewidth=0.6,
151155
linestyle="--",

0 commit comments

Comments
 (0)