✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

How do I add a border to the subplots?

I am trying to add borders to the 3d subplots. For reference please the below image.

And my plotly graph looks like below:

How can I add borders in python Plotly?

Thank you.

I solved this using go.layout.shape! Thank you.

Can you elaborate on that further?

Your answer in the current state is not very helpful.

Sure, you just need to add a shape element to your figure to add border. For example, see the following snippet:

fig.update_layout( shapes=[
# unfilled rectange
go.layout.Shape(
type=“rect”,
xref=“paper”,
yref=“paper”,
x0=0,
y0=-0.1,
x1=1.05,
y1=1,
line={‘width’: 1, ‘color’: ‘black’}),
# line
go.layout.Shape(
type=“line”,
xref=“paper”,
yref=“paper”,
x0=0.5,
y0=-0.1,
x1=0.5,
y1=1,
line={‘width’: 1, ‘color’: ‘black’}), ])

Hi @Tanaya,

Just noticed you have two overlapping color-bars. Since they refer to the same data you can just do showscale=False for the second trace.

Alex-

Hello Alex,

Thanks for pointing that out. I have made those changes! :slight_smile: