rich-iannone / DiagrammeRsvg

A utility package for providing SVG export to DiagrammeR graph diagrams
Other
29 stars 1 forks source link

export_svg() ignores height and width properties of the grViz object #10

Open ajlyons opened 2 years ago

ajlyons commented 2 years ago

This is a really useful package. I've been experimenting with different ways to use export_svg() to embed a DiagrammeR diagram in a Rmarkdown HTML document, such that I can control the display dimensions. A constraint I keep bumping into is that export_svg() seems to ignore the height and width properties of the grViz object. Rather it seems to picks its own, and because the height and width attributes are element properties it's not easy to override them with CSS.

I've written a workaround function to manually edit the height and width attributes of the svg string returned by export_svg(), which works ok but I'm wondering if there's a cleaner way of specifying the output dimensions by passing something or other to V8?

gzagatti commented 2 years ago

I'm having the same problem here, @ajlyons is a great workaround.