Skip to content

Exporting networkD3 plots to editable vector formats (PDF/SVG) with preserved styling #309

@LianaCRossi

Description

@LianaCRossi

Dear @christophergandrud,

First, thank you for the incredible networkD3 package - it's revolutionized how we create interactive network visualizations in R.

I’m currently trying to export a networkD3 plot to an editable vector file format, such as PDF or SVG, in order to add custom annotations, adjust labels, and refine visual elements for publication.

I've tried a few approaches, including using the browser’s print-to-PDF function and exporting to SVG and export using and the r code
(htmlwidgets::saveWidget and webshot::webshot funcions). However, in all cases I encounter issues such as loss of original layout or styling configured in the HTML widget (e.g., link weights, node colors).

What I’m looking for is a way to preserve the exact appearance of the HTML output, but in a vector-based, editable format, ideally compatible with tools like Adobe Illustrator or Inkscape. Is it currently possible to export networkD3 plots to PDF or SVG while maintaining all layout and styling features? If not directly, is there a recommended workflow or R script that can help achieve this?

Any tips or guidance would be greatly appreciated!

Thanks in advance,

Liana Chesini Rossi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions