1

I've been using the Glasgow Haskell Compiler (GHC) to learn Haskell. I installed the gnuplot package using Cabal (I used the command cabal install --lib gnuplot). I can load the gnuplot module, however, when I try to use gnuplot, it doesn't display the function plot:

ghci> :m Graphics.Gnuplot.Simple     
ghci> plotFunc [][1.0,1.01..10.0] sin
ghci> ghc-9.2.8.exe: gnuplot: readCreateProcessWithExitCode: does not exist (No such file or directory)

I've already tried uninstalling and reinstalling the package, which doesn't solve the problem. I think it might be linked to my computers Path and environment variables, but I don't know what to do.

4
  • Is gnuplot itself installed? It looks like the library is installed OK, but at runtime it can not find the gnuplot executable.
    – chi
    Sep 18 at 22:45
  • Run where gnuplot in a cmd prompt. Does it print the file path?
    – cela
    Sep 19 at 0:48
  • You need to install gnuplot itself. The library basically generates a gnuplot script and passes this to the gnuplot executable to plot it. Sep 19 at 12:18
  • @WillemVanOnsem that works, thank you very much! Sep 19 at 17:52

1 Answer 1

0

Haskell's gnuplot library does not replicate the gnuplot program. It basically is a wrapper that writes a gnuplot program and passes that to gnuplot.

But in order to plot, gnuplot thus has to do the actual work. You thus need to install gnuplot on your system. For example for a debian-like system, we an install gnuplot with:

$ sudo apt-get install gnuplot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.