Example using Tk::PlotDataset

| | Comments (0) | TrackBacks (0)
Here is an a screenshot of the example file examples/tkplotdataset:
View image


#!/usr/bin/perl 
use Tk;
use Tk::PlotDataset;
use Tk::LineGraphDataset;
use Math::GSL::SF qw/:all/;
use strict;

my $window = MainWindow->new(
    -title => 'Math::GSL Plot',
);
my @region = map { $_/10 } (-400 .. -1, 0, 1 .. 400);
my @data1  = map { gsl_sf_bessel_J0($_) } (@region);
my $dataset1 = LineGraphDataset->new(
    -name => 'gsl_sf_bessel_J0',
    -xData => \@region,
    -yData => \@data1,
    -yAxis => 'Y',
    -color => 'red'
);

my @data2 = map { gsl_sf_bessel_J1($_) } (@region);
my $dataset2 = LineGraphDataset->new(
    -name => 'gsl_sf_bessel_J1',
    -xData => \@region,
    -yData => \@data2,
    -yAxis => 'Y1',
    -color => 'blue'
);

my $graph = $window->PlotDataset(
    -width => 500,
    -height => 500,
    -background => 'snow'
) -> pack(-fill => 'both', -expand => 1);

$graph->addDatasets($dataset1, $dataset2);
$graph->plot;
MainLoop;
exit(1);

0 TrackBacks

Listed below are links to blogs that reference this entry: Example using Tk::PlotDataset.

TrackBack URL for this entry: http://leto.net/mt/mt-tb.cgi/26

Leave a comment

About this Entry

This page contains a single entry by Jonathan Leto published on August 2, 2008 1:28 PM.

Week 9 report was the previous entry in this blog.

Week 10 report is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Screw you, spammers! Clicky Web Analytics