scalanlp / breeze

Breeze is a numerical processing library for Scala.
www.scalanlp.org
Apache License 2.0
3.44k stars 691 forks source link

Request: make plot not automatically show a window #852

Closed phdoerfler closed 1 year ago

phdoerfler commented 1 year ago

I'd like to generate graphs using the visualization package, e.g.,

import breeze.linalg._
import breeze.plot._

val f = Figure()
val p = f.subplot(0)
val x = linspace(0.0,1.0)
p += plot(x, x ^:^ 2.0)
p += plot(x, x ^:^ 3.0, '.')
p.xlabel = "x axis"
p.ylabel = "y axis"
f.saveas("lines.png")

This does work and generate a file lines.png. However, it also opens a Java Swing window showing the plot. In my brief search I could not find an easy way to turn this off so I kindly ask for a way to be added to generate visualizations without them automatically opening a GUI window.

Especially if you are using breeze in a scala worksheet, it is rather annoying having to close the window every time you save the worksheet.

phdoerfler commented 1 year ago

of course, just after writing this, I figured out out how it's done:

val f = Figure()
f.visible = false