Title Alignment Python

I’m trying to plot a simple bar chart, and the title, when I add it via fig.update_layout , seems to automatically align to the left of the chart. How can I change the title settings such that the title of the bar chart aligns with the center of the graph?

I noticed that there was some discussion for this but for plotly.js a while back (https://github.com/plotly/plotly.js/issues/882) , and that there is a xanchor attribute for the title that takes in parameters for left/right/center/auto. However, in changing the xanchor value, the title does not align with the center of the graph with any of the attribute values.

An example of what I’d like to do is to move the “January 2013 Sales Report” Title from the following graph: https://plot.ly/python/bar-charts/#bar-chart-with-hover-text

from the left to the center of the image. Can anyone point me in the correct direction?

Thanks!

@chen0095 To get a centered title perform the following layout update:

fig.update_layout(title_text='Your title', title_x=0.5)

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online