# How are plot titles positioned?

**URL:** <https://community.plotly.com/t/how-are-plot-titles-positioned/1950>\
**Category:** plotly.js\
**Created:** [August 23, 2016, 5:58pm UTC](https://community.plotly.com/t/how-are-plot-titles-positioned/1950 "2016-08-23T17:58:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajzeigert](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ajzeigert/32/510_2.png) [@ajzeigert](https://community.plotly.com/u/ajzeigert)\
**Post date:** [August 23, 2016, 5:58pm UTC](https://community.plotly.com/t/how-are-plot-titles-positioned/1950/1 "2016-08-23T17:58:30Z")

</div>

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/](https://jsfiddle.net/ajzeigert/fmha6jmk/1/)

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

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [August 24, 2016, 2:36pm UTC](https://community.plotly.com/t/how-are-plot-titles-positioned/1950/2 "2016-08-24T14:36:57Z")

</div>

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](https://github.com/plotly/plotly.js/blob/5b92305206ec84df05fddda65b7f4033170b3bb7/src/components/titles/index.js), which gets called for the main title [here](https://github.com/plotly/plotly.js/blob/5b92305206ec84df05fddda65b7f4033170b3bb7/src/plot_api/plot_api.js#L3108-L3121) and for the axis titles [here](https://github.com/plotly/plotly.js/blob/5b92305206ec84df05fddda65b7f4033170b3bb7/src/plots/cartesian/axes.js#L1753-L1760).

> [@ajzeigert](#):
>
> Is there any way to control that that title position via layout properties?

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

---

<div class="post-metadata">

**Author:** ![ajzeigert](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ajzeigert/32/510_2.png) [@ajzeigert](https://community.plotly.com/u/ajzeigert)\
**Post date:** [August 24, 2016, 4:45pm UTC](https://community.plotly.com/t/how-are-plot-titles-positioned/1950/3 "2016-08-24T16:45:07Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![skm](https://avatars.discourse-cdn.com/v4/letter/s/97f17d/32.png) [@skm](https://community.plotly.com/u/skm)\
**Post date:** [October 11, 2016, 10:16pm UTC](https://community.plotly.com/t/how-are-plot-titles-positioned/1950/4 "2016-10-11T22:16:55Z")

</div>

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/](https://plot.ly/python/3d-scatter-plots/) and add title to layout it doesn’t show up properly. How to get around this ?
