Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Chart::Gnuplot png format

by hmadhi (Acolyte)
on Sep 12, 2011 at 09:52 UTC ( #925437=perlquestion: print w/replies, xml ) Need Help??
hmadhi has asked for the wisdom of the Perl Monks concerning the following question:

Weird. I am unable to create a png file using Chart::Gnuplot. All necessary is installed (ImageMagick) for the convert utility. The output is set to file.png. I have also tried $chart->convert('png') and $chart->('png'). The output file is always "PostScript document text conforming at level 2.0". I have also tried jpg and gif but always get the some output type. If I manually use the convert utility all works fine. Any ideas. Using Chart::Gnuplot 0.16.

Replies are listed 'Best First'.
Re: Chart::Gnuplot png format
by keszler (Priest) on Sep 12, 2011 at 11:04 UTC

    According to Chart::Gnuplot:

    If the filename has no extension, postscipt will be used.

    Examine your $chart->output('file.png'); line; it's not working.

Re: Chart::Gnuplot png format
by roboticus (Chancellor) on Sep 12, 2011 at 13:52 UTC


    While you've installed ImageMagick, is Chart::Gnuplot finding ImageMagick properly? Are you checking for errors? Do any error messages involve convert?


    When your only tool is a hammer, all problems look like your thumb.


      No error messages. convert is installed in /usr/bin/

Re: Chart::Gnuplot png format
by ambrus (Abbot) on Sep 12, 2011 at 14:53 UTC

    See also Re: Draw chart for a complete code example generating a PNG image output with gnuplot.

Re: Chart::Gnuplot png format
by ww (Archbishop) on Sep 12, 2011 at 10:12 UTC
    My idea is that it would be a lot easier to help you if you posted your corde.

      Code is as follows:

      my $chart = Chart::Gnuplot->new(output =>"file.png", gnuplot => /usr/bin/gnuplot", ) $chart->plot2d($dataSet0, $dataSet1);
Re: Chart::Gnuplot png format
by hmadhi (Acolyte) on Sep 14, 2011 at 06:43 UTC

    I have found the "problem". I have been plotting datasets that do not contain data. eg

    $chart->plot2d($dataSet0, $dataSet1, $dataSet2;)

    where dataSet0 returns a set of null values. In the previous version of Chart::Gnuplot this was not an issue and I did not have this problem. Such datasets were ignored and the conversion takes place correct. Remember, I am getting a ps file being generated, only the convert is not working. If I do a manual convert the graph is plotted correct.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://925437]
Approved by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-06-23 17:10 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.