Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d44d567

Browse files
authored
Merge pull request #13239 from anntzer/sankey-log
Improve sankey logging.
2 parents 0908440 + 57c3e1b commit d44d567

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

examples/specialty_plots/sankey_rankine.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
Rankine power cycle
44
===================
55
6-
Demonstrate the Sankey class with a practical example of a Rankine power
7-
cycle.
8-
6+
Demonstrate the Sankey class with a practical example of a Rankine power cycle.
97
"""
8+
109
import matplotlib.pyplot as plt
1110

1211
from matplotlib.sankey import Sankey

lib/matplotlib/sankey.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -464,21 +464,12 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
464464
"'trunklength' is negative, which is not allowed because it "
465465
"would cause poor layout")
466466
if np.abs(np.sum(flows)) > self.tolerance:
467-
_log.info("The sum of the flows is nonzero (%f).\nIs the "
468-
"system not at steady state?", np.sum(flows))
467+
_log.info("The sum of the flows is nonzero (%f; patchlabel=%r); "
468+
"is the system not at steady state?",
469+
np.sum(flows), patchlabel)
469470
scaled_flows = self.scale * flows
470471
gain = sum(max(flow, 0) for flow in scaled_flows)
471472
loss = sum(min(flow, 0) for flow in scaled_flows)
472-
if not (0.5 <= gain <= 2.0):
473-
_log.info(
474-
"The scaled sum of the inputs is %f.\nThis may "
475-
"cause poor layout.\nConsider changing the scale so"
476-
" that the scaled sum is approximately 1.0.", gain)
477-
if not (-2.0 <= loss <= -0.5):
478-
_log.info(
479-
"The scaled sum of the outputs is %f.\nThis may "
480-
"cause poor layout.\nConsider changing the scale so"
481-
" that the scaled sum is approximately 1.0.", gain)
482473
if prior is not None:
483474
if prior < 0:
484475
raise ValueError("The index of the prior diagram is negative")

0 commit comments

Comments
 (0)