0

When you plot something with matplotlib a viewer pops up. You can zoom and pan you image. It is vector image because you can zoom as much as you like. If you save the image as : svg, eps or png the result is not as good as the one in the matplotlib-own-viewer.

Is there way to save it in whatever matplotlib is using to display and then open it in the matplotlib-viewer later??

thanks

PS> if not at least if there is a way to make the svg-lines thinner !!

1 Answer 1

1

It's not really a vector image, the viewer is continuously rendering a view of the data in the plot, you know? If you zoom in on the svg; you're still zooming in: the lines had a thickness before so they're going to get thicker the more you zoom in. What you could do is have your script write the necessary code to a new script (with .py extension) so you can just open that and get the plot you want again. After all, matplotlib kind of uses python to "display" so in a way that is really the only answer to your question :-)

let's say you have

a = [1,2,3,4,5]
b = [1,4,9,16,25]
d = open("plotly.py","w")
d.write("from pylab import *\nx = %s\ny=%s\nplot(x,y)\nshow()"%(a,b))
d.close()

You could generalize that a bit; but that would be the gist I think. Have fun!

Sign up to request clarification or add additional context in comments.

2 Comments

clever... based on your advice, I save my data to pickle and then wrote pylab-script to show it. thanks
Oh yeah pickle is really nice. I vaguely remember trying this with some really long lists but they got truncated somehow iirc... Pickle is probably better behaved in that respect. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.