Skip to content

Commit

Permalink
mostly correct the calculation of plot height
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed Mar 19, 2024
1 parent ce28bc0 commit c84d7f0
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions ausankey/ausankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,29 @@ def sankey(

for ii in range(num_side):
if ii == 0:
weight_sum[ii] = data[2 * ii + 1].sum()
ind_prev = data[2 * ii + 1].notnull()
ind_this = data[2 * ii + 1].notnull()
ind_next = data[2 * ii + 3].notnull()
elif ii == num_side-1:
weight_sum[ii] = data[2 * ii + 1].sum()
ind_prev = data[2 * ii - 1].notnull()
ind_this = data[2 * ii + 1].notnull()
ind_next = data[2 * ii + 1].notnull()
else:
# this is an overestimate, should be trimmed of entries that terminate but overlap
weight_sum[ii] = data[2 * ii + 1].sum()

ind_prev = data[2 * ii - 1].notnull()
ind_this = data[2 * ii + 1].notnull()
ind_next = data[2 * ii + 3].notnull()

weight_cont = data[2 * ii + 1][ind_this & ind_prev & ind_next].sum()
weight_only = data[2 * ii + 1][ind_this & ~ind_prev & ~ind_next].sum()
weight_stop = data[2 * ii + 1][ind_this & ind_prev & ~ind_next].sum()
weight_strt = data[2 * ii + 1][ind_this & ~ind_prev & ind_next].sum()

weight_next = data[2 * ii + 1][ind_next].sum()

Check failure on line 179 in ausankey/ausankey.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F841)

ausankey/ausankey.py:179:9: F841 Local variable `weight_next` is assigned to but never used
weight_sum[ii] = weight_cont + weight_only + max(weight_stop, weight_strt)

for ii in range(num_side):
col_hgt[ii] = weight_sum[ii] + (num_uniq[ii] - 1) * bar_gap * max(weight_sum)
# need to count the nodes actually used rather than the maximum

# overall dimensions
plot_height = max(col_hgt)
Expand Down

0 comments on commit c84d7f0

Please sign in to comment.