Hi @peter34 ,
If you don’t need the white border frame color, you maybe need to use Dash, instead of just plotly graph objects.
The tricks is to give style on <body>
tag of the page background-color:#25499F;
.
You can put that style at app.index_string
to give <body>
tag background color .
app = Dash(__name__)
app.index_string = """
<!DOCTYPE html>
<html>
<head>
{%metas%}
<title>{%title%}</title>
{%favicon%}
{%css%}
</head>
<body style="background-color:#25499F;">
{%app_entry%}
<footer>
{%config%}
{%scripts%}
{%renderer%}
</footer>
</body>
</html>
"""
then I put together the code use Dash and your very first post code.
(I use dummy data to create scatter plot)
from dash import Dash, html, dcc
from plotly import graph_objects as go
import numpy as np
# dummy data
rng = np.random.default_rng()
start_val = 0
end_val = 1000
x = np.linspace(start_val,end_val,100)
y = rng.integers(0,180,100)
#scatter object
scatter_plot = go.Scatter(x=x,y=y)
layout = go.Layout(
# title="Scatter Plot",
xaxis=dict(
range=[start_val, end_val],
),
legend=dict(
bgcolor='rgba(255, 255, 255, 0)',
bordercolor='rgba(255, 255, 255, 0)'
),
yaxis=dict(
range=(0, 200),
),
font_color="white",
plot_bgcolor="#25499F",
)
fig = go.Figure(data=[scatter_plot], layout=layout)
fig.update_traces(line_color="#F88416")
fig.update_xaxes(gridcolor="#015BA0")
fig.update_yaxes(gridcolor="#015BA0")
fig.update_layout(paper_bgcolor="#25499F")
app = Dash(__name__)
app.index_string = """
<!DOCTYPE html>
<html>
<head>
{%metas%}
<title>{%title%}</title>
{%favicon%}
{%css%}
</head>
<body style="background-color:#25499F;">
{%app_entry%}
<footer>
{%config%}
{%scripts%}
{%renderer%}
</footer>
</body>
</html>
"""
app.layout = dcc.Graph(figure=fig)
if __name__ == "__main__":
app.run_server(debug=False)
Now the white frame is disappeared.
Hope this help.