problem with colorbar LaTeX title rendering
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
I am trying to implement a LaTeX math title for my colorbar and plotly is having some trouble rendering it. I am using Python 2.7, Plotly 4.5.2. My code:
fig = go.Figure()
fig.add_trace(go.Scatter(x=x_data,
y=y_data,
mode='markers',text=obj_name,name='',
marker=dict(symbol='circle',size=12,line=dict(width=1,color='SlateGray'),
opacity=0.75,color=log_mbh,colorscale='Rainbow',showscale=True,
cmin=6.0,cmax=8.0,
colorbar=dict(title=dict(text=r'$\Large\alpha\beta\gamma\delta$',side='top'),
thickness=50,tickmode='array',tickvals=[6.0,6.5,7.0,7.5,8.0]),
),
)
)
fig.add_trace(go.Scatter(x=np.arange(0,300,10), y=np.arange(0,300,10),
line = dict(color='LightSlateGray', width=2, dash='dash')))
fig.update_layout(
template='plotly_white',
xaxis = dict(showgrid=False,ticks='inside',zeroline=True,zerolinecolor='black',rangemode='tozero'),
yaxis = dict(showgrid=False,ticks='inside',zeroline=True,zerolinecolor='black',rangemode='tozero'),
xaxis_title=dict(text=r'$x$'),
yaxis_title=dict(text=r'$y$'),
font=dict(size=16),
showlegend = False,
autosize = False,
width = 750,
height = 750,
margin = dict(l=50,r=50,b=50,t=50,pad=10),
)
fig.show()
Which produces the output:

As you can see, the LaTeX title seems to be rotated 90 deg, and ignoring side='top'. I have tried to increase the width of the colorbar and increase the plot's margins to no avail. Is there a workaround or solution for this problem?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Python 2.7 and Plotly 4.5.2 reproduction, then trace how the colorbar title handles LaTeX text and side='top'. Done means the title renders with the requested LaTeX and top orientation without breaking other colorbar titles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100