带有Matplotlib标签位置的Sankey

问题描述 投票:0回答:1

此之后:Sankey with Matplotlib我编写了此代码:

from matplotlib.sankey import Sankey
import matplotlib.pyplot as plt
from matplotlib import rcParams


## Plotten
plt.rc('text', usetex=True)
plt.rc('text.latex', preamble=r'\usepackage{underscore}') 
plt.rc('font', family='serif')
plt.rcParams['font.size'] = 18
plt.rcParams['font.serif'] = "Linux Libertine"

fig = plt.figure(figsize = [10,10], dpi=330)
ax = fig.add_subplot(1, 1, 1,)

Sankey(ax=ax,  flows = [ 20400,3000,-19900,-400,-2300,-800],
              labels = ['Value K',   'Value S', 'Value H',   'Value F', 'Value Sp', 'uncertainty'],
        orientations = [ 1,    1,   -1,     -1,   0,  1 ],
        scale=1/40000, trunklength=1, unit = 'kg', pathlengths=0.5, gap=.5, 
        edgecolor = '#000000', facecolor = 'grey'
      ).finish()
plt.axis("off")
plt.show()

此结果:enter image description here

如何将标签(或值)从图表中移出?

并且有一种方法可以获取“。”值中的千位分隔符,例如20.400kg?

python matplotlib sankey-diagram
1个回答
0
投票

我知道了

© www.soinside.com 2019 - 2024. All rights reserved.