8000 Improve sankey logging. by anntzer · Pull Request #13239 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Improve sankey logging. #13239

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 1 commit into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
10000
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions examples/specialty_plots/sankey_rankine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
Rankine power cycle
===================

Demonstrate the Sankey class with a practical example of a Rankine power
cycle.

Demonstrate the Sankey class with a practical example of a Rankine power cycle.
"""

import matplotlib.pyplot as plt

from matplotlib.sankey import Sankey
Expand Down
15 changes: 3 additions & 12 deletions lib/matplotlib/sankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,21 +464,12 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
"'trunklength' is negative, which is not allowed because it "
"would cause poor layout")
if np.abs(np.sum(flows)) > self.tolerance:
_log.info("The sum of the flows is nonzero (%f).\nIs the "
"system not at steady state?", np.sum(flows))
_log.info("The sum of the flows is nonzero (%f; patchlabel=%r); "
"is the system not at steady state?",
np.sum(flows), patchlabel)
scaled_flows = self.scale * flows
gain = sum(max(flow, 0) for flow in scaled_flows)
loss = sum(min(flow, 0) for flow in scaled_flows)
if not (0.5 <= gain <= 2.0):
_log.info(
"The scaled sum of the inputs is %f.\nThis may "
"cause poor layout.\nConsider changing the scale so"
" that the scaled sum is approximately 1.0.", gain)
if not (-2.0 <= loss <= -0.5):
_log.info(
"The scaled sum of the outputs is %f.\nThis may "
"cause poor layout.\nConsider changing the scale so"
" that the scaled sum is approximately 1.0.", gain)
if prior is not None:
if prior < 0:
raise ValueError("The index of the prior diagram is negative")
Expand Down
0