# Retain editable text on saving to PDF, Plots-GR

**URL:** <https://discourse.julialang.org/t/retain-editable-text-on-saving-to-pdf-plots-gr/83609>\
**Category:** Visualization\
**Tags:** plots, gr\
**Created:** [July 1, 2022, 11:16am UTC](https://discourse.julialang.org/t/retain-editable-text-on-saving-to-pdf-plots-gr/83609 "2022-07-01T11:16:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iabraham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iabraham/32/36532_2.png) [@iabraham](https://discourse.julialang.org/u/iabraham)\
**Post date:** [July 1, 2022, 11:16am UTC](https://discourse.julialang.org/t/retain-editable-text-on-saving-to-pdf-plots-gr/83609/1 "2022-07-01T11:16:07Z")

</div>

This was already posted [here](https://stackoverflow.com/questions/72822916/julia-plots-gr-export-to-pdf-retain-text-editability) 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`](https://jonathansoma.com/lede/data-studio/matplotlib/exporting-from-matplotlib-to-open-in-adobe-illustrator/).

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.

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [July 1, 2022, 11:43am UTC](https://discourse.julialang.org/t/retain-editable-text-on-saving-to-pdf-plots-gr/83609/2 "2022-07-01T11:43:49Z")

</div>

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`, …

```julia
using Plots
plot(randn(10), fontfamily="times")
```

---

<div class="post-metadata">

**Author:** ![iabraham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iabraham/32/36532_2.png) [@iabraham](https://discourse.julialang.org/u/iabraham)\
**Post date:** [July 1, 2022, 12:10pm UTC](https://discourse.julialang.org/t/retain-editable-text-on-saving-to-pdf-plots-gr/83609/3 "2022-07-01T12:10:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iabraham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iabraham/32/36532_2.png) [@iabraham](https://discourse.julialang.org/u/iabraham)\
**Post date:** [July 1, 2022, 12:45pm UTC](https://discourse.julialang.org/t/retain-editable-text-on-saving-to-pdf-plots-gr/83609/4 "2022-07-01T12:45:18Z")

</div>

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:

![Screen Shot 2022-07-01 at 07.40.55](https://global.discourse-cdn.com/julialang/original/3X/e/4/e4943a02589bb88b2836d7522616fa71c76802d3.png)

vs

![Screen Shot 2022-07-01 at 07.41.18](https://global.discourse-cdn.com/julialang/original/3X/b/5/b5b623c2cac711cd3555d462760eedda90e6883f.png)

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.

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [July 4, 2022, 11:15am UTC](https://discourse.julialang.org/t/retain-editable-text-on-saving-to-pdf-plots-gr/83609/5 "2022-07-04T11:15:59Z")

</div>

May be, this is an option for you (although vector text):

```julia
using GR
plot(randn(10),title="Empirical distribution of \$\\lambda_1 / \\lambda_2\$",font="DejaVuSans")

```

 ![Screenshot 2022-07-04 at 13.14.14](https://global.discourse-cdn.com/julialang/original/3X/2/7/27ea3811943a63dbbd9d7c9f3e4c72e2b172f42d.png)
