Fine-Grained Position of a Colorbar Title?

I know I can position the title of a colorbar using titleside (top, bottom, or right, apparently) but I’d like to center-align the title on the top and it defaults to left-aligned. Is it possible to center-align?

I’ve got a Choropleth map of the US with a colorbar. Here’s the relevant code if that helps understand a bit more of the context. Thanks!

fig = px.choropleth(
    data_frame=data,
    #projection='orthographic', # Only use this with scope='north america'
    locationmode='USA-states',
    locations='StateCode',
    scope="usa",
    color=per_million,
    range_color=(0,199),  # This keeps the color key consistent between different race data
    hover_data=['State', killed],
    color_continuous_scale=scale_colors,
    #labels={'ColorBarLabel': 'Number Killed By Police Per Million'},
    template='plotly_dark',
)

fig.update_layout(margin={"r":0,"t":20,"l":0,"b":0}, 
    geo=dict(bgcolor='#202b38', lakecolor='#4E5D6C'),
    paper_bgcolor='#202b38',
    plot_bgcolor='#202b38',
    width=1000,
    coloraxis_colorbar=dict(
                        title="Number of People<br>Killed Per Million",
                        titleside='top',
                        thicknessmode="pixels", thickness=40,
                        lenmode="pixels", len=300,
                        yanchor="bottom", y=0.14,
                        xanchor="right", x=1.0
                        ),                   
    )
1 Like

I have a similar need in one of our dashboard. Did you find a solution @russmcb ?