Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add more space between title and Sankey Diagram?

I'm using python with plotly to create Sankey Diagram. this it the text for the title/subtitles & a picture of the problem (the title overlaps with the diagram). How can I create more space between the two? I've tried adding "height=#' to the layout but that changes the width of my Sankey Diagram instead.

line2="From time: "+str(time_from)+" to time: "+str(time_to)
line3="\nDATA 1:"+"{:.4f}".format(pue)
line4="\nDATA 2 :"+"{:.4f}".format(ere)

layout =  dict(
        title = 'TITLE HERE'+ '<br>' + '<span style="font-size: 12px;">'+line2+'</span>' + '<br>' + '<span style="font-size: 12px;">'+line3+'</span>' + '<br>' + '<span style="font-size: 12px;">'+line4+'</span>',
        

)

enter image description here Also, my Sankey Diagram code set up is similar to the answer to this stack overflow question: Plotly Sankey diagram group label and color

like image 759
carsof Avatar asked Oct 28 '25 05:10

carsof


1 Answers

Using the code in the other question that you provided, and simply just adding this line into your code: f.update_layout(margin=dict(t=200)) you can change something like this:

into this:

You can obviously try out different values to see what works best for you, but simply adding the update_layout to change the margin for the top (t) should do the job for you.

like image 97
AS11 Avatar answered Oct 29 '25 20:10

AS11



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!