my $chart = Chart::Gnuplot->new( output => 'test.png', # not "terminal => 'windows'" ... #### my $output_id = 0; # put this before the MainLoop call ... sub plot { $chart->plot3d($dataSet); my $newname = sprintf( "test_%03d.png", ++$output_id ); rename( "test.png", $newname ); my $top = $mw->Toplevel( -title => $newname ); my $img = $top->Photo( -file => $newname ); my $lbl => $top->Label( -image => $img )->pack; }