Skip to content

Commit 09876d5

Browse files
committed
invert y aes to preserve order top-down
1 parent 9fc7a60 commit 09876d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/arviz_plots/plots/forestplot.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ def plot_forest(
271271
np.linspace(-0.2, 0.2, distribution.sizes["chain"]),
272272
coords={"chain": distribution.chain},
273273
)
274+
y_ds = xr.Dataset({key: values["y"] for key, values in aes_dt.children.items()})
275+
y_ds = y_ds.max().to_array().max() - y_ds
276+
for var_name, child in aes_dt.children.items():
277+
child["y"] = y_ds[var_name]
274278
plot_collection.aes = aes_dt
275279

276280
if aes_map is None:
@@ -302,7 +306,6 @@ def plot_forest(
302306

303307
# add labels and shading first, so forest plot is rendered on top
304308
_, lab_aes, lab_ignore = filter_aes(plot_collection, aes_map, "labels", sample_dims)
305-
y_ds = xr.Dataset({key: values["y"] for key, values in plot_collection.aes.children.items()})
306309
cumulative_label = []
307310
x = 0
308311
for label in labellable_dims:

0 commit comments

Comments
 (0)