vegas-viz/Vegas

Equivalent to matplotlib's `savefig` ?

andb0t opened this issue · 3 comments

Hi,
I browsed the repo and googled but couldn't find if there is an option equivalent to matplotlib's savefig. I need my code to run without X server and produce the plots as pdf or png. Does this option exist?

I am also looking for this feature. Does anyone have any suggestions?

FYI: I solved it by running an Xserver (in my case Xming for Windows Subsystem for Linux (WSL))

You can find my implementation here: click

FYI: As an experiment, I added the following code to WindowRenderer#show(), but it output a white blank png.

val image = window.webView.snapshot(new SnapshotParameters(), null)
val bufferedImage = SwingFXUtils.fromFXImage(image, null)
ImageIO.write(bufferedImage, "png", new File("output.png"))

javafx may not support such a use case?
cf. https://stackoverflow.com/a/23444861/9625883