import matplotlib.pyplot as plt
#plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
#plt.rcParams['axes.unicode_minus']=False #用来正常显示负号
# 有中文出现的情况,需要u'内容'
import numpy as np
from matplotlib.sankey import Sankey
sankey = Sankey(scale=0.01, unit='%', format='%.0f', gap=0.25, radius=0.1,
shoulder=0.03, offset=0.15, head_angle=100, margin=0.3, tolerance=1e-06)
sankey.add(flows=[97.4, 1.2, 1.4, -19.8, -22.5, -10.0, -12.1, -9.0,-17.5,-8.9],
labels=['', '', '', '', '', '', '', '', '', ''],
orientations=[0, -1, 1, 1, 1, 1, 0, -1,-1,-1],
pathlengths=[0.5, 0.5, 0.5, 0.25, 0.25, 0.6, 0.25, 0.25,
0.25,0.25])
diagrams = sankey.finish()
diagrams[0].patch.set_facecolor('white')
plt.show()
