Center legend affecting graph, not legend

Using the following code:

legend=dict(orientation='h',yanchor='top',xanchor='center',y=1)

It looks like it’s centering the graph, not the legend. Am I doing something wrong ?

Thanks,

what if you try:

legend=dict(orientation='h',yanchor='top',xanchor='center',y=1,x:0.5)

Thanks Etienne.
Weirdly enough, I used x=0.15. 0.5 was too far to the right. I will keep the “x=” in mind.

hi,

how can you have the legend just simply on top of the chart in the middle ?

because orientation=‘v’ places it on the right side
and orientation=‘h’ places it on the bottom which then usually overlaps the ticks of the x-axis.
the “safe position” would be as a one liner on top of the chart area but below the title.