8000 Improvements to Sankey class by kdavies4 · Pull Request #1574 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Improvements to Sankey class #1574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 7, 2012
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed typos in Sankey
  • Loading branch information
kdavies4 committed Dec 7, 2012
commit 11737f362d9ce5c37787d0d1f298356b03f32a99
28 changes: 14 additions & 14 deletions lib/matplotlib/sankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# http://matplotlib.org/examples/api/sankey_demo_old.html
# Modifications by Kevin Davies (kld@alumni.carnegiemellon.edu) 6/3/2011:
# --Used arcs for the curves (so that the widths of the paths are uniform)
# --Converted the function to a class and created methods to join
# multiple simple Sankey diagrams
# --Converted the function to a class and created methods to join multiple
# simple Sankey diagrams
# --Provided handling for cases where the total of the inputs isn't 100
# Now, the default layout is based on the assumption that the inputs sum to
# 1. A scaling parameter can be used in other cases.
Expand All @@ -29,7 +29,7 @@
# inputs/outputs are now specified via an orientation of 0, and there may
# be several of each.
# --Added assertions to catch common calling errors
# -Added the physical unit as a string argument to be used in the labels, so
# --Added the physical unit as a string argument to be used in the labels, so
# that the values of the flows can usually be applied automatically
# --Added an argument for a minimum magnitude below which flows are not shown
# --Added a tapered trunk in the case that the flows do not sum to 0
Expand Down Expand Up @@ -395,10 +395,10 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
*orientations* == 0, inputs will break in from the
left and outputs will break away to the right.
*labels* list of specifications of the labels for the flows
Each value may be None (no labels), '' (just label
the quantities), or a labeling string. If a single
value is provided, it will be applied to all flows.
If an entry is a non-empty string, then the
Each value may be *None* (no labels), '' (just
label the quantities), or a labeling string. If a
single value is provided, it will be applied to all
flows. If an entry is a non-empty string, then the
quantity for the corresponding flow will be shown
below the string. However, if the *unit* of the
main diagram is None, then quantities are never
Expand All @@ -417,7 +417,7 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
*connect* a (prior, this) tuple indexing the flow of the
prior diagram and the flow of this diagram which
should be connected
If this is the first diagram or *prior* is None,
If this is the first diagram or *prior* is *None*,
*connect* will be ignored.
*rotation* angle of rotation of the diagram [deg]
*rotation* is ignored if this diagram is connected
Expand Down Expand Up @@ -460,7 +460,7 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
if rotation is None:
rotation = 0
else:
# In the code below, angles are expressed in deg/90
# In the code below, angles are expressed in deg/90.
rotation /= 90.0
if orientations is None:
orientations = [0, 0]
Expand Down Expand Up @@ -741,10 +741,10 @@ def _get_angle(a, r):
kwds = dict(s=patchlabel, ha='center', va='center')
text = self.ax.text(*offset, **kwds)
if False: # Debug
print "llpath\n", llpath
print "ulpath\n", self._revert(ulpath)
print "urpath\n", urpath
print "lrpath\n", self._revert(lrpath)
print("llpath\n", llpath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a from __future__ import print_function. We need to target py2.x when we code, and allow for 2to3 to take care of any py3k issues for us.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I included this in commit 92575e2 below.

print("ulpath\n", self._revert(ulpath))
print("urpath\n", urpath)
print("lrpath\n", self._revert(lrpath))
xs, ys = zip(*vertices)
self.ax.plot(xs, ys, 'go-')
patch = PathPatch(Path(vertices, codes),
Expand Down Expand Up @@ -816,7 +816,7 @@ def finish(self):
(DOWN), and an output from the top side will have
an angle of 1 (UP). If a flow has been skipped
(because its magnitude is less than *tolerance*),
then its angle will be None.
then its angle will be *None*.
*tips* array in which each row is an [x, y] pair
indicating the positions of the tips (or "dips") of
the flow paths
Expand Down
0