Black Lives Matter. Please consider donating to Campaign Zero's mission of ending police violence in America.

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 ( , 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:

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


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

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