Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

How are plot titles positioned?

I’m trying to add subtitles and other header info to a plot. My original approach was to add
's and new lines to the title field, but there were some positioning issues. Next I tried using annotations, but again, some positioning issues emerged.

My big question is: How is the position of the title set? It seems that as I adjust margins, the title position changes. But adding new lines to the title doesn’t seem to affect position. See this fiddle for an example of a shifted title due to margin change:

https://jsfiddle.net/ajzeigert/fmha6jmk/1/

Is there any way to control that that title position via layout properties?

The main (layout.title) title is positioned at the center of graph’s width as set in layout.width.

The axis titles are positioned at the center of the axis span.

For more details, you can look up the source code for the title drawing method here, which gets called for the main title here and for the axis titles here.

Not at the moment unfortunately. I’d recommend using paper-referenced annotations for more custom-looking titles.

@etienne Yeah, I’ve been working on that. Paper seems to reference the edges of the plot itself, not the entire drawing space. So if I increase the margin of the plot to accommodate an additional annotation above, the y position for all annotations needs to be adjusted accordingly. It’s a pain, but sounds like it’s the only way. I’ll try to put together a fiddle of the exact problem I’m working on later.

Thanks for getting back to me!

The title is getting cut off for me in my 3D scatter plot, both in jupyter notebook as well as online. Only the bottom most part of the text is showing up. There needs to be a way to position title. Even upon using annotations they show up cut off on the right most corner. Is this an issue with 3d scatter ? Infact if I copy paste this example https://plot.ly/python/3d-scatter-plots/ and add title to layout it doesn’t show up properly. How to get around this ?