Editable text in exported svg plots

73 views (last 30 days)
Martin Cermak
Martin Cermak on 6 Apr 2019
Edited: David Burghoff on 1 Feb 2022
I am trying to estabilish the most efficient workflow for exporting matlab plots, finetuning them in a vector graphics editor, and including them in scientific publications. My plan was to export the plots as .svg using saveas or print commands and then do the finetuning in Inkscape. Unfortunately the text (in figure titles, ticks, legend, etc.) is exported as curves and cannot be edited.
Here are a few things that I have tried:
  • using plot2svg - unfortunately the most of my plots are of the errorbar type. plot2svg doesn't seem to be able to handle those.
  • experimenting with saveas, print, and saving manually using 'File>Save as' in the figure window - all of these give the same result
  • exporting the figures as pdf or eps and opening them in inkscape - the text IS exported as text objects, however editing acts funny in Inkscape. When typing, the characters stack on top of each other.
Has anyone experienced and resolved this issue? Is there any other way how to get easily editable svg files?
I tried to attach my svg file, but apparently it is not supported by Matlab Central. I've added the pdf instead.
Thanks!
Martin
  1 Comment
David Burghoff
David Burghoff on 1 Feb 2022
Edited: David Burghoff on 1 Feb 2022
My Flattener Inkscape extension will convert manually-kerned text from PDFs into normal text.
(I know it has been some time since you asked, but I thought it could benefit someone else.)

Sign in to comment.

Answers (1)

Martin Cermak
Martin Cermak on 4 May 2019
One little step forward is this tip on the Incscape website (http://wiki.inkscape.org/wiki/index.php/Release_notes/0.46#PDF_and_AI_import):
Text editing tips: Any text imported from PDF or AI has each letter's precise place on the page fixed. While this preserves the exact appearance (e.g. justification of text blocks) of the imported document, it makes editing such text difficult: deleting text fails to contract the text line and inserting text fails to expand it, i.e. typed letters overlay the existing letters. (However, you still can replace a letter with another letter of about the same width, although you may need to kern it into place with Alt+arrows.)
To work around this, select the text object you want to edit and use Text > Remove manual kerns command. This will remove the exact positioning information, so if the text block was justified it will lose justification, but instead you will be able to edit it as usual.
Note that there is a way to select even a single line in a text block. For this, open the XML editor, expand the <svg:text> tree branch corresponding to your text, and select any of the <svg:tspan> objects under it. Now you can remove manual kerns from this line only. After you finish editing the line, you can manually justify it back, for example by adding spaces, manual kerns (Alt+arrows), or by adjusting letterspacing (select the whole line and use Alt+> or Alt+<).

Categories

Find more on Printing and Saving in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!