2

I have the following example. I would like to change the position of the info Info3 and Info 2 in the group 2 to have them more on the left.

I tried to change trunklength = 0.6, without success.

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

fig = plt.figure(figsize = (13, 7), frameon = False)
ax = fig.add_subplot(1, 1, 1, xticks = [], yticks = [])
sankey = Sankey(ax = ax, 
    format = '%.6G', 
   unit = 'kWh', 
    scale = 1/1500,
    offset = 0.2,# offset du texte par rapport à la flêche
    shoulder = 0.0)

#first group 
sankey.add(
    flows = [ 1000],
    orientations = [0], 
    labels = ['GHI'],
    pathlengths = [0.4]
    )

#group2
sankey.add(
    #patchlabel = 'Essai',
    #      entre| sortie| infoS
    flows = [ 1000,-768,-200,-32,-2,],
    orientations = [0,0,-1,1,-1],
    labels= [None, None,'INfo 2','INfo 1','INfo 3'],)

#Group 3

sankey.add(
    flows = [768, -698, -70],
    orientations = [0, 0, -1],
    labels = [None, 'ECS consommée','Pertes thermique des ballons'],
    prior = 1,
    connect = (1, 0)
)

sankey.finish()
plt.show()

result needed

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Johnvador
  • 21
  • 5
  • 2
    I think this is not possible as it's [hard coded](https://github.com/matplotlib/matplotlib/blob/4b5fc9478d4f19e4ccaf01c583ad1e342f1aadbc/lib/matplotlib/sankey.py#LL627C71-L627C71) that any outputs start from the middle of the total length – Stef Jun 14 '23 at 10:27

0 Answers0