Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ugly parallel arrows in sankey #13184

Open
Labels
keepItems to be ignored by the “Stale” Github Actiontopic: sankey
@colinmorris

Description

@colinmorris

Edit by@anntzer: The main issue reported below has been fixed in#13213, but#13184 (comment) remains; the issue title has been edited accordingly.

I encountered a couple issues with theorientations argument toSankey.add:

1. Confusing error message iflen(flows) > 2 andorientations not specified

Repro:

frommatplotlib.sankeyimportSankeysankey=Sankey()sankey.add(flows=[1,-.33,-.67],)sankey.finish()

This gives:

ValueError: orientations and flows must have the same length.orientations has length 2, but flows has length 3.

Expected: Some reasonable default behaviour, or a comprehensible error message.

Why is it saying thatorientations has length 2? I didn't specify a value, and its default value isNone.

Also,orientations is listed as anoptional keyword argument, so the fact that this fails at all is a little surprising. It seems like all the other arguments in the list are truly optional (I can even specify exactly one ofprior orconnect and not get an exception).

2. Passing a scalar fororientations fails

labels andpathlengths can be passed as either a list, or a single string/number. If a scalar is passed, it's treated as a list with that scalar repeated the appropriate number of times.

This is not the case fororientations. e.g. the following fails withTypeError: object of type 'int' has no len():

frommatplotlib.sankeyimportSankeysankey=Sankey()sankey.add(flows=[1,-.33,-.67],orientations=0,)sankey.finish()

Expected: No exception. Behaviour equivalent to if I had passedorientations=[0, 0, 0].

The docs suggest this should work, per the following quote from the docstring:

Iforientations == 0, inputs will break in from the left and outputs will break away to the right.

Matplotlib version

  • Operating system: Ubuntu 16.04
  • Matplotlib version: 3.0.2 (installed via pip)
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    keepItems to be ignored by the “Stale” Github Actiontopic: sankey

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp