0

I am new to Python. Just working with OSMnx and wanted to open a map as an svg in Illustrator. This was posted in the GitHub documentation:

# you can also plot/save figures as SVGs to work with in Illustrator later fig, ax = ox.plot_graph(G_projected, save=True, file_format='svg')

I tried it in JupyterLab and it downloaded to my files but when I open it, it is just text. How can I correctly download it and open as SVG? - Thanks!

TrevPennington
  • 435
  • 5
  • 15

2 Answers2

3
fig, ax = ox.plot_graph(G, filepath='image.svg', save=True, show=False, close=True)

Run the line of code. It saves an SVG file called image.svg. Open that file in the SVG program of your choice (Adobe Illustrator, etc).

[edit: updated code snippet for recent OSMnx releases]

gboeing
  • 5,691
  • 2
  • 15
  • 41
  • 1
    When I run this in jupyter lab I get `plot_graph() got an unexpected keyword argument 'filename'`. I've also tried saving using `osmnx.io.save_graph_xml`. Could you please update this answer? – AlexJ136 Mar 06 '21 at 12:38
0

Instead of

filename='image', file_format='svg'

Use:

filepath='image.svg'