This was already posted here and I am not sure if cross posting is allowed, but this community seems much more active.
I am trying to save some figures I made in Julia (Plots package, GR backend) to PDFs and I love the aesthetics + being able to save as vector graphics. However, I may need to invariably tweak things in Illustrator. When in Matlab, the plots exported as PDF are by default editable, e.g. it is an easy few clicks to replace all fonts. Something similar can also be done for matplotlib
.
So my question: how can I export to PDF with editable text (this means something like Illustrator will treat text as text instead of paths) using the default backend?
Googling around, it seems the same matplotlib
hack above might work in Julia via Plots.pyrcparams
, but I am afraid to change backends and then having to fix a dozen plots because things broke.
All font families except serif-roman
, sans-serif
, computer modern
and dejavu sans
should be “editable” in PDF or SVG files, e.g. times
, helvetica
, bookman
, courier
, newcenturyschlbk
, avantgarde
, palatino
, …
using Plots
plot(randn(10), fontfamily="times")
1 Like
Okay. I was indeed using Computer Modern because it goes nicely with Latex document that the figures go to and works seamlessly with LaTexStrings package. I will check with a supported font family.
Okay, if I may follow up, is there a fontfamily
that works well with Latex and will also result in “editable” texts in PDFs? Three of those listed (except deja-vu sans) as resulting in non-editable PDFs work well with Latex (and by that I don’t mean aesthetics, more like alignment issues).
For example:
vs
I am happy to use Helvetica in figures and Computer Modern in my text … as long as I can also display math/latex symbols in figures also.
May be, this is an option for you (although vector text):
using GR
plot(randn(10),title="Empirical distribution of \$\\lambda_1 / \\lambda_2\$",font="DejaVuSans")