#! perl -slw use strict; use GD::Graph::lines; my @logConc = 1 .. 50; my @data = map{ -3 + rand( 6 ) } 1 .. 50; my @graphs = map GD::Graph::lines->new(500,300, 1), 1..2; for ( @graphs ) { $_->set( x_label => 'Logged stuff', y_label => 'Intensity', title => "Plot of stuff", line_width => 1, legend_spacing => 5, x_tick_number => 'auto', box_axis => 0, y_min_value => -2, y_max_value => 2, transparent => 0 ) or die $_->error; $_->set_legend('legend'); } ## Draw the full graph my $gd1 = $graphs[ 0 ]->plot( [ \@logConc, \@data ] ) or die $graphs[0]->error; ## Draw another with the same size and options, but null data. my $gd2 = $graphs[ 1 ]->plot([[0],[0]]); ## Copy the relevant portion of the full graph over the empty one $gd2->copy( $gd1, 0, 20, 0, 20, 500, 230 ); ## And display the latter. open PNG, '>:raw', 'junk.png'; print PNG $gd2->png(); close PNG; system 'junk.png';