Skip to content

Instantly share code, notes, and snippets.

@SHDShim
Last active January 13, 2024 22:52
Show Gist options
  • Save SHDShim/2c5933424dfcf63ab68400400d895430 to your computer and use it in GitHub Desktop.
Save SHDShim/2c5933424dfcf63ab68400400d895430 to your computer and use it in GitHub Desktop.
matplotlib output PDF editable illustrator

How to Make matplotlib output PDF editable in illustrator

This may not need anymore after matplotlib 3.5.

source: http://jonathansoma.com/lede/data-studio/matplotlib/exporting-from-matplotlib-to-open-in-adobe-illustrator/

import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42

matplotlib.pyplot.rcParams.update({
    "pgf.preamble": [
         "\\usepackage{arev}",
        "\\usepackage[T1]{fontenc}"]
})

plt.savefig("output-bargraph.pdf", transparent=True, bbox_inches='tight')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment