Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saving as an svg is not straightforward for each engine #1

Open
chanana opened this issue Jun 7, 2023 · 0 comments
Open

saving as an svg is not straightforward for each engine #1

chanana opened this issue Jun 7, 2023 · 0 comments

Comments

@chanana
Copy link
Collaborator

chanana commented Jun 7, 2023

for engine in ["plotly", "matplotlib", "bokeh"]:
    print(engine)
    p = Plotter(engine)
    fig = p.make_mirror_plot(
        mz1, int1, mz2, int2, label_top="top", label_bottom="bottom", title="mirror plot"
    )
    hv.save(fig, f"../example_data/figs/mirror_plot_{engine}.svg", fmt="svg")

gives

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[6], line 7
      3 p = Plotter(engine)
      4 fig = p.make_mirror_plot(
      5     mz1, int1, mz2, int2, label_top="top", label_bottom="bottom", title="mirror plot"
      6 )
----> 7 hv.save(fig, f".[./example_data/figs/mirror_plot_](https://file+.vscode-resource.vscode-cdn.net/Users/shaurya/code/mspaint/notebooks/example_data/figs/mirror_plot_){engine}.svg", fmt="svg")

File [~/code/mspaint/.venv/lib/python3.9/site-packages/holoviews/util/__init__.py:801](https://file+.vscode-resource.vscode-cdn.net/Users/shaurya/code/mspaint/notebooks/~/code/mspaint/.venv/lib/python3.9/site-packages/holoviews/util/__init__.py:801), in save(obj, filename, fmt, backend, resources, toolbar, title, **kwargs)
    799     if formats[-1] in supported:
    800         filename = '.'.join(formats[:-1])
--> 801 return renderer_obj.save(obj, filename, fmt=fmt, resources=resources,
    802                          title=title)

File [~/code/mspaint/.venv/lib/python3.9/site-packages/holoviews/plotting/renderer.py:579](https://file+.vscode-resource.vscode-cdn.net/Users/shaurya/code/mspaint/notebooks/~/code/mspaint/.venv/lib/python3.9/site-packages/holoviews/plotting/renderer.py:579), in Renderer.save(self_or_cls, obj, basename, fmt, key, info, options, resources, title, **kwargs)
    573     param.main.param.warning("Supplying plot, style or norm options "
    574                        "as keyword arguments to the Renderer.save "
    575                        "method is deprecated and will error in "
    576                        "the next minor release.")
    578 with StoreOptions.options(obj, options, **kwargs):
--> 579     plot, fmt = self_or_cls._validate(obj, fmt)
    581 if isinstance(plot, Viewable):
    582     from bokeh.resources import CDN, INLINE, Resources

File [~/code/mspaint/.venv/lib/python3.9/site-packages/holoviews/plotting/renderer.py:314](https://file+.vscode-resource.vscode-cdn.net/Users/shaurya/code/mspaint/notebooks/~/code/mspaint/.venv/lib/python3.9/site-packages/holoviews/plotting/renderer.py:314), in Renderer._validate(self, obj, fmt, **kwargs)
    312 all_formats = set(fig_formats + holomap_formats)
    313 if fmt not in all_formats:
--> 314     raise Exception("Format %r not supported by mode %r. Allowed formats: %r"
    315                     % (fmt, self.mode, fig_formats + holomap_formats))
    316 self.last_plot = plot
    317 return plot, fmt

Exception: Format 'svg' not supported by mode 'default'. Allowed formats: ['html', 'auto', 'png', 'widgets', 'scrubber', 'gif', 'auto', None]

stackOverflow says: https://stackoverflow.com/a/65267737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant