I first created a template for my drawing and then applied the template using PlotlyLight.settings.layout.template = a_template
. But the saved image is still the unapplied template version. Is there any solution for this please?
using PlotlyLight, PlotlyKaleido
PlotlyKaleido.start()
a_template = Config()
a_template.layout.title = Config(
font = Config(family="Arial", size=20),
x = 0.5,
xanchor = "center",
)
a_template.layout.plot_bgcolor = "white"
a_template.layout.paper_bgcolor = "white"
a_template.layout.xaxis = Config(
showline = true,
linecolor = "black",
linewidth = 1,
mirror = true,
ticks = "inside",
tickfont = Config(family="Arial", size=14, color="black"),
title = Config(font=Config(family="Arial", size=16)),
gridcolor = "rgba(0,0,0,0.1)",
zeroline = false,
)
a_template.layout.legend = Config(
font=Config(family="Arial", size=12),
bgcolor="rgba(0,0,0,0)",
borderwidth=0,
)
PlotlyLight.settings.layout.template = a_template
p = plot.scatter(x=1:20, y=cumsum(randn(20)), mode="lines+markers", line=Config(width=2))
PlotlyKaleido.savefig(p, "myplot.svg");
(Of course, the purpose of creating a template is to customize a uniform style for all my drawings. If there are other ways to accomplish this, that’s fine too.)