in reply to GD graph Invalid data set
print IMG $graph1->png;
should be
print IMG $gd->png;
You didn't provide any data so I made some up to get a working program :-
poj#!/usr/bin/perl use strict; use warnings; use GD::Graph::lines; use GD::Graph::colour; GD::Graph::lines->import(); GD::Graph::colour->import(qw(:colours :lists :files :convert)); my @graph_R1 = ([1..50], [1..50], [11..60], [21..70]); my $graph1 = GD::Graph::lines->new(800,600); add_colour(nice_blue => [31,120,180]); $graph1->set( x_label => 'position (bp)', y1_label => '% methylation', y2_label => '# methylation calls', title => 'Mbias plot Read 1', line_width => 2, x_max_value => 125, x_min_value => 0, y_tick_number => 10, y_label_skip => 2, y1_max_value => 100, y1_min_value => 0, y_label_skip => 2, y2_min_value => 0, x_label_skip => 5, x_label_position => 0.5, x_tick_offset => -1, bgclr => 'white', transparent => 0, two_axes => 1, use_axis => [1,1,1,2,2,2], legend_placement => 'RC', legend_spacing => 6, legend_marker_width => 24, legend_marker_height => 18, dclrs => [ qw(nice_blue) ], )or die $graph1->error; $graph1->set_legend('CpG methylation'); my $gd = $graph1->plot(\@graph_R1) or die $graph1->error; open(IMG, '>','test.png') or die $!; binmode IMG; print IMG $gd->png;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: GD graph Invalid data set
by sramazan (Initiate) on Jan 16, 2015 at 20:33 UTC | |
by poj (Abbot) on Jan 16, 2015 at 20:41 UTC |