0

When I use Matplotlib's plt.show() I get a nice Plot which can can be zoomed to very high precision(practically infinite). But when I save it as a image it loses all this information gives information depending on resolution.

Is there any way I can save the plot with the entire information? i.e Like those interactive plots which can rescaled at any time?

P.S- I know I can set dpi to get high quality images. This is not what I want. I want image similar to Plot which python shows when I run the program. What format is that? Or is it just very high resolution image?

Note- I am plotting .csv files which includes data varying from 10^(-10) to 100's. Thus when I save the plot as .png file I lose all the information/kinks of graph at verн small scales and only retain features from 1-100.

Indigo1729
  • 153
  • 8
  • A png is by its nature static; you can't keep all your data points in memory and zoom to see them. Is a linear plot truly the most appropriate for you? It is likely you could get more meaning by making the axis logarithmic. The only other alternative I could think of is to make the plot extremely big, and then in your image viewer, just zoom out a lot. But that static data will never be as useful as your live plot. – Scott Mermelstein Jun 26 '18 at 14:17
  • Possible duplicate of [saving images in python at a very high quality](https://stackoverflow.com/questions/16183462/saving-images-in-python-at-a-very-high-quality) – Shibasis Patel Jun 26 '18 at 14:24
  • @ShibasisPatel I've added P.S to the question. No this is not same as the one you've given. I know I can do that using dpi. – Indigo1729 Jun 27 '18 at 03:50
  • @iPython I know how to save as image(plt.savefig). Please reread the question and understand my problem. That question is definitely not same as mine. – Indigo1729 Jun 27 '18 at 03:50

1 Answers1

0

Maybe the interactive graphic library bokeh is an option for you. See here. It's API is just little different from what you know from matplotlib. Bokeh creates plots as html files that you can view in your browser. For each graphic you can select wheel zoom to zoom interactively into your graphic. You can change interactively the range that you want to be plotted. Therefore you don't loose information in your graphic.

Alex G
  • 663
  • 3
  • 13
  • But even in this when I save it has th problem. My data is 1mil x 10 size and hence loading and plotting it each takes time. Is there no way I can save the interactive plots themselves? – Indigo1729 Jun 27 '18 at 03:55