1

I'm trying to create simple plots using graph as described in this tutorial. However, even the most basic example:

echo 0 0 1 1 2 0 | graph -T png > plot.png

produces a perfectly white 570x570 picture. The picture looks normal otherwise, having a correct PNG header and both white and black colors in the palette.

I'm using plotutils 2.4.1 under Windows 7. Is it known to be broken or am I missing something silly?

PS. I've moved to gnuplot for the time being, but if someone has a solution/experience to share, I'm still interested.

Dmitry Grigoryev
  • 8,643
  • 3
  • 37
  • 69

1 Answers1

1

I agree with your decision to switch to gnuplot. It can accomplish a wider range of actions. With the info you provided I can just try to guess that or the png drivers are missing or some variable is not correctly set.

Notes:

  • Try to update to a more recent version
  • You are using, you know, a tool developed for *nix systems. Since the png format is a proprietary one, under Linux there are compatible library that have to be installed separately.

  • graph may behave differently depending on the environment in which it is invoked.

    Moreover for this kind of tools can be important the environment variables under which the program runs.
    We can read that, among the others, the png file production is specifically affected by some environment variables, for example [2]

    Similarly, the BITMAPSIZE environment variable affects the operation of graph -T X, graph -T png, graph -T pnm, and graph -T gif.

    Moreover [3],[4]

    graph -T png and graph -T gif, which produce output in PNG and pseudo-GIF format respectively, are affected by two environment variables. If the value of the INTERLACE variable is "yes", the output file will be interlaced. Also, if the value of the TRANSPARENT_COLOR environment variable is the name of a color that appears in the output file, that color will be treated as transparent by most applications.


BTW the command you provided

echo 0 0 1 1 2 0 | graph -T png > plot.png

under Linux generate the following image, that I suppose was your purpose. Your example

The Imagemagick [5] identify plot.png answers

plot.png PNG 570x570 570x570+0+0 8-bit PseudoClass 2c 2.1KB 0.000u 0:00.000

Tested with [graph (GNU plotutils) 2.6]

Hastur
  • 17,781
  • 8
  • 48
  • 90
  • Yep, that graph is indeed what I expected to get. I don't think my issue is due to missing PNG libs, since the file I get is a valid PNG picture (only blank). 2.4.1 is the latest Win32 build I could find, do you have a link to a newer version I could try out? – Dmitry Grigoryev Dec 22 '15 at 15:48
  • [Plotutils site](https://www.gnu.org/software/plotutils/) that send you to [gnu mirrors](http://www.gnu.org/prep/ftp) for example [here](http://mirror.tochlab.net/pub/gnu/plotutils/), but I suppose you have to compile it... else a good overkill: a virtual machine with Linux inside (Ubuntu `sudo apt-get install plotutils`) :-) – Hastur Dec 22 '15 at 15:55
  • Those look like source packages, and I don't have a build environment at hand, sorry. Looks like a solution though so I'll accept your answer (by now, I have too many scripts using `gnuplot`, it simply doesn't make sense to switch back to `graph`). – Dmitry Grigoryev Dec 22 '15 at 15:59
  • I see that it is included in [Cygwin](https://en.wikipedia.org/wiki/Cygwin). Maybe you can install Cygwin... but I try to tempt you with pure Linux... under virtualbox :) – Hastur Dec 22 '15 at 16:58