Skip to content

Instantly share code, notes, and snippets.

@briandk
Last active June 30, 2021 02:41
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save briandk/fd3fe7f9816478b0415a to your computer and use it in GitHub Desktop.
Save briandk/fd3fe7f9816478b0415a to your computer and use it in GitHub Desktop.
Preamble for high resolution and vector-graphic plots in Jupyter Notebook
# Make plots inline
%matplotlib inline
# Make inline plots vector graphics instead of raster graphics
# from IPython.display import set_matplotlib_formats
# set_matplotlib_formats('pdf', 'svg')
# DeprecationWarning: `set_matplotlib_formats` is deprecated since IPython 7.23, directly use `matplotlib_inline.backend_inline.set_matplotlib_formats()`
import matplotlib_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('retina', 'png', quality = 100)
# import modules for plotting and data analysis
import matplotlib.pyplot # as plt
import numpy
import pandas
import seaborn
@foice
Copy link

foice commented Aug 18, 2018

will there be a way to "Save image as..." ? In my browser I had that option for PNG output, but is no longer there now with SVG, furthermore for PDF I get a "view PDF" link, which is even dead. Any clue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment