SVG static export takes 20 odd seconds

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

Hi @rajuah,

Can you include a complete reproducible example (In particular, one that includes imports and data)?

-Jon

Hi Jon @jmmease. Thanks for the quick reply. I work from behind an enterprise firewall and I suspect the firewall gating/slowing the orca server in some way. I tried the same script on a Mac and Win PC outside of my enterprise network and the static export took less than 0.3sec in each case.
I think its fair to say, orca and plotly are performing as they should. Thanks for the great plotting packages :slight_smile:

I do have one question related to orca - Is it possible to run orca in a completely offline mode? If so, what other dependencies need to be made locally available?

Akhilesh

Hi @rajuah,

I do have one question related to orca - Is it possible to run orca in a completely offline mode? If so, what other dependencies need to be made locally available?

Yes, when used from plotly.py orca should work fully offline. When used from the command line, you need to use the --plotlyjs command line argument to specify the path to a local plotly.js bundle. This is because orca itself doesn’t ship with a bundled version of plotly.js and by default it loads plotly.js from an online CDN location. Plotly.py does this automatically to point orca to the version of plotly.js that’s bundled with plotly.py.

-Jon