r-lib / svglite

A lightweight svg graphics device for R
https://svglite.r-lib.org
180 stars 39 forks source link

Allow getting back the svg as a string #40

Closed Hampei closed 8 years ago

Hampei commented 9 years ago

We're trying out a few ways of rendering svg's from R and svglite seems to create the nicest svg's by far.

But we use R as service and only ever return json from our scripts, which makes writing to disk and reading from it a unnecessary expensive task that needs clean up.

Defining either a ofstream or a std::stringstream at the top, based on whether a filename has been passed, should make this doable, without too much overhead. Though I appreciate the code will need to be move a bit more to the c++ side of syntax.

I might have a go at this soon if you feel you would accept such a pull l request.

hadley commented 9 years ago

I'd be happy to review a PR.

hadley commented 9 years ago

This would also be a nice way of supporting #6, assuming there's a C++ stream class that does compression.