Is there any way to get live preview of plots from Owl_plplot?

When I call plot from Owl_plplot I get a list of options:

utop # Plot.plot x y;;

Plotting Options:
 < 1> ps         PostScript File (monochrome)
 < 2> psc        PostScript File (color)
 < 3> xfig       Xfig file
 < 4> null       Null device
 < 5> mem        User-supplied memory device
 < 6> svg        Scalable Vector Graphics (SVG 1.1)
 < 7> pdfcairo   Cairo PDF Driver
 < 8> epscairo   Cairo EPS Driver
 < 9> pscairo    Cairo PS Driver
 <10> svgcairo   Cairo SVG Driver
 <11> pngcairo   Cairo PNG Driver
 <12> memcairo   Cairo memory driver
 <13> extcairo   Cairo external context driver

I haven’t tried them all.

<11> pngcairo Cairo PNG Driver works, but it’s what I’m trying to avoid.

I was hoping one of these would pop up a graphical window to instantly view the plot?

<12> memcairo Cairo memory driver crashed with:

Must call plsmem first to set user plotting area!
Program aborted

Different library Oplot (oplot.Oplot) looks like what I want, but was not able to install its dependency ocamlsdl-0.9.1 which seems some ancient dead lib on sourceforge.

(I’d be fine using another lib if Owl doesn’t do this and another exists)

it is indeed old, but in principle quite stable. It requires the (old) SDL1.2 library. Do you have it on your system? (for instance libsdl1.2-dev on ubuntu)

I am on macos

I have:

brew info sdl
Warning: Use sdl12-compat instead of deprecated sdl
==> sdl12-compat: stable 1.2.60 (bottled), HEAD
SDL 1.2 compatibility layer that uses SDL 2.0 behind the scenes

brew info sdl12-compat
==> sdl12-compat: stable 1.2.60 (bottled), HEAD
SDL 1.2 compatibility layer that uses SDL 2.0 behind the scenes

opam install ocamlsdl gives:

# checking for sdl-config... /opt/homebrew/bin/sdl-config
# checking for SDL - version >= 1.2.0... no
# *** Could not run SDL test program, checking why...
# *** The test program failed to compile or link. See the file config.log for the
# *** exact error that occured. This usually means SDL was incorrectly installed
# *** or that you have moved SDL since it was installed. In the latter case, you
# *** may want to edit the sdl-config script: /opt/homebrew/bin/sdl-config
# configure: error: *** SDL version 1.2.0 not found!

/opt/homebrew/bin/sdl-config script exists

I can’t find the config.log file mentioned

mmm, so now there is sdl12-compat instead of the original sdl12, maybe this is the cause… I can’t test on macos though

Maybe that’s good occasion to convert oplot to sdl2

1 Like

version 0.6 (github) now uses SDL2 (via tsdl)

1 Like

Nice, I’ll give it a try!