I am trying to use plotly (offline mode) in python along with orca to export contour plots to SVG.
Given below is the function I use to create contour plots and export it to SVG
x_axis_options = dict(
zeroline=False,
nticks=len(x_axis),
tickmode="auto",
title="UI",
mirror=True,
)
y_axis_options = dict(
zeroline=False,
title="Voltage (Codes)",
mirror=True
)
layout = go.Layout(
xaxis=x_axis_options,
yaxis=y_axis_options
)
def plot_contour_filled_to_svg():
fig = go.Figure(layout=layout)
fig.add_contour(
x=x_axis,
y=y_axis,
z=scan_data,
contours=dict(showlines=False),
colorscale="Jet",
)
pio.write_image(
fig,
"C:/Users/akhilesh/PycharmProjects/contour_filled.svg",
)
plot_contour_filled_to_svg()
It takes roughly 20s to create an SVG every single time. Is this expected behavior?
I though maybe file IO part of the write command is causing that delay so instead of the write_image
, I used the to_image
to get a bytes representation of the same. That didnt help with the runtime either
I ran the orca server manually in debug mode (looked at a few posts in forums) but I dont know how to make sense of it.
Can someone help me out? @jmmease