JetBrains / lets-plot-kotlin

Grammar of Graphics for Kotlin
https://lets-plot.org/kotlin/
MIT License
422 stars 36 forks source link

Exports a plot to memomy buffer by ggsave #139

Closed fmvin closed 11 months ago

fmvin commented 1 year ago

ggsave exports plot only to a file. Please extends ggsave to export a plot to data buffer.

alshan commented 1 year ago

Hi @fmvin , depending on your needs, you can use PlotSvgExport, PlotHtmlExport or PlotImageExport utility, in a way similar to how they are used in ggsave().

Will this work for you? At least as a workaround.

alshan commented 11 months ago

Hi, just added small demo which uses org.jetbrains.letsPlot.core.plot.export.PlotImageExport utility to obtain bytes of a plot image along with the image dimensions:

https://github.com/alshan/lets-plot-mini-apps/blob/main/jvm-plot-export/src/main/kotlin/ExportPNG.kt