Skip to content

Add bottom-up and right-left orientations for Sankey diagrams#7870

Open
wf-r wants to merge 4 commits into
plotly:masterfrom
wf-r:Add_bottom-up_and_right-left_orientation_for_Sankey
Open

Add bottom-up and right-left orientations for Sankey diagrams#7870
wf-r wants to merge 4 commits into
plotly:masterfrom
wf-r:Add_bottom-up_and_right-left_orientation_for_Sankey

Conversation

@wf-r

@wf-r wf-r commented Jun 26, 2026

Copy link
Copy Markdown

What

See #7865

Adds two new flow directions to Sankey traces and gives the existing horizontal/vertical modes explicit, direction-named aliases, fully backward compatible.

orientation now accepts:

  • h — horizontal, default (unchanged)
  • left-right — sources left, flow rightward (synonym of h)
  • right-left — sources right, flow leftward (new)
  • v — vertical (unchanged)
  • top-down — sources top, flow downward (synonym of v)
  • bottom-up — sources bottom, flow upward (new)

Why

So far, h is always left→right and v is always top-down. Right-to-left and build-up (bottom-up) flows are common conventions with no equivalent today. This closes both gaps additively, without changing any existing rendering.

Backward compatibility

Purely additive. Existing figures using h/v render identically; the default is unchanged.

wfr added 4 commits June 26, 2026 07:25
\Extend the Sankey 'orientation' attribute with four direction-namedvalues while keeping the legacy ones as synonyms:  - left-right (synonym of h): sources left, flow rightward  - right-left:                sources right, flow leftward (new)  - top-down (synonym of v):   sources top, flow downward  - bottom-up:                 sources bottom, flow upward (new)right-left and bottom-up are mirrors of the existing horizontal andvertical layouts, each expressed as a single group-level matrix plustranslate in sankeyTransform(). right-left counts as horizontal forlayout sizing, dragging and hover-axis mapping; only the group ismirrored. Node labels get an updated counter-transform so glyphs stayupright, and right-left flips the outer-side text-anchor.plot.js: replace the '=== v' link-hover check with a proper verticaltest so left-right/right-left are not transposed, and mirror the flowaxis for bottom-up (y) and right-left (x).Default stays h; existing h/v figures render identically.Tests: orientation coercion for all values plus invalid fallback, anda group-transform assertion per orientation.
Adjust node label alignment for vertical case (labels below still need work)
Finalize node label alignment for vertical cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant