Issues importing R plots in SVG format


I’m trying to drag-and-drop an SVG plot into Figma

But the result is this:

The file renders wonderfully well in Inkscape and a web browser.

This makes Figma really hard to use in our case.

How can this be fixed?

It seems Figma is closing the paths, then filling them with black, and ignoring stroke colors.

The paths are not closed in the original SVG.

The issue can be circumvented by:

  • Opening the R SVG plot in Inkscape,
  • For preserving text as text:
    • ungroup all elements (using “Ctrl+Shift+G”)
    • select a text element and select same object type (Edit → Select Same → Object Type, or “Alt+Shift+A”)
    • invert the selection (using Edit → Object to path or “!”),
  • Convert selected objects to paths (using Path → Object to path, or "Ctr+Shift+C).

Having to do this for each plot is really annoying :confused: it would be nice if it just worked…

You can use ggsave with device=svg (Note, not device=“svg”)