TypeError while saving a plot to SVG
See original GitHub issueWhile using cml.plot_map
with a path
argument to save the plot as SVG, the following error appears, even though the plot is successfully saved to a .svg
file. This error does not appear when saving the file to pdf
or png
.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-35-aab10829c1c0> in <module>()
1 # cml.plot_map(data, title=True)
----> 2 cml.plot_map(data, title=True, path="test-grib-plot.svg")
/usr/local/lib/python3.7/dist-packages/climetlab/plotting/__init__.py in plot_map(data, **kwargs)
176 p = new_plot(**kwargs)
177 p.plot_map(data)
--> 178 p.show()
179
180
/usr/local/lib/python3.7/dist-packages/climetlab/plotting/__init__.py in show(self)
120
121 def show(self):
--> 122 self.backend.show(display=display)
123
124 def macro(self) -> list:
/usr/local/lib/python3.7/dist-packages/climetlab/plotting/backends/magics/backend.py in show(self, display)
327 Display = Image # noqa: N806
328
--> 329 return display(Display(path, metadata=dict(width=width)))
330
331 def save(self, path):
TypeError: __init__() got an unexpected keyword argument 'metadata'
Steps to reproduce
# download the grib file that comes with ClieMetLab
!wget https://raw.githubusercontent.com/ecmwf/climetlab/develop/docs/examples/test.grib
Load the file and try to plot it with while saving also providing path for plot be saved in svg
import climetlab as cml
data = cml.load_source("file", "test.grib")
cml.plot_map(data, title=True, path="test-grib-plot.svg")
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Python matplotlib: Error while saving scatter plot in svg format
I would like to save this plot to a svg file with events so that the svg file can be viewed in a...
Read more >Matplotlib How to Save a Plot - codingem.com
Here are three tips for making saving matplotlib figures more seamless. Tip 1: Specify the File Format. When saving a plot, you can...
Read more >Outputting SVG source of a plot - ASKSAGE: Sage Q&A Forum
Given a plot, how do I return the source code of its SVG representation? ... Save the plot into a file (see note...
Read more >Plotting a filled contour and saving as eps or svg
I would like to simply plot a filled contour for given x, y, and z variables (or a function z(x,y)), and save it...
Read more >The config module (pystata.config)
The config module (pystata.config)¶ · gformat (str) – The graph format. It can be svg, png, or pdf. · perm (bool, optional) –...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The reason why I pointed to them is that if we want to ensure compatibility with the collab environment, we may need similar tweaks. I do not know if there is any issue with these other functions. “If it is not broken, don’t fix it”, I think we can close the current issue (adding more tests would be good otherwise but this is another point)
Got it. Thank you for time and guidance.