plotutils: `graph` создает пустые графики

318
Dmitry Grigoryev

Я пытаюсь создать простые графики с использованием, graphкак описано в этом руководстве . Однако, даже самый простой пример:

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

производит идеально белое изображение 570x570. В противном случае картинка выглядит нормально, имеет правильный заголовок PNG и белый и черный цвета в палитре.

Я использую plotutils 2.4.1 под Windows 7. Известно, что она сломана или я что-то упустил?

PS. Я перешел на gnuplotнекоторое время, но если у кого-то есть решение / опыт, которым я могу поделиться, мне все равно интересно.

1

1 ответ на вопрос

1
Hastur

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]

Да, этот график действительно то, что я ожидал получить. Я не думаю, что моя проблема связана с отсутствием библиотек PNG, так как файл, который я получаю, является допустимым изображением PNG (только пустым). 2.4.1 это последняя сборка Win32, которую я смог найти, есть ли у вас ссылка на более новую версию, которую я мог бы попробовать? Dmitry Grigoryev 8 лет назад 0
[Сайт Plotutils] (https://www.gnu.org/software/plotutils/), который отправляет вас к [gnu mirrors] (http://www.gnu.org/prep/ftp), например, [здесь] (http : //mirror.tochlab.net/pub/gnu/plotutils/), но я полагаю, вы должны скомпилировать его ... еще хороший перебор: виртуальная машина с Linux внутри (Ubuntu `sudo apt-get install plotutils`) :-) Hastur 8 лет назад 0
Они похожи на пакеты с исходным кодом, и у меня нет среды для сборки под рукой, извините. Выглядит как решение, поэтому я приму ваш ответ (сейчас у меня слишком много сценариев, использующих `gnuplot`, просто нет смысла переключаться обратно на` graph`). Dmitry Grigoryev 8 лет назад 0
Я вижу, что он включен в [Cygwin] (https://en.wikipedia.org/wiki/Cygwin). Может быть, вы можете установить Cygwin ... но я пытаюсь соблазнить вас чистым Linux ... под virtualbox :) Hastur 8 лет назад 0