#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;
# Initiate the chart object
my $chart = Chart::Gnuplot->new(
output => 'plotStyle_16.png',
title => "Vector field",
);
# The data points
my @points = (
[0.0, 0.0, -0.2, -0.2],
[0.5, 0.5, -0.2, 0.0],
[0.5, -0.5, 0.2, 0.2],
[1.0, -0.5, 0.0, -0.2],
[1.5, 1.0, 0.0, 0.2],
[2.0, -1.0, 0.2, -0.2],
[2.0, 0.0, -0.1, -0.2],
[2.5, -0.5, 0.2, 0.0],
);
# Data set object
my $vectors = Chart::Gnuplot::DataSet->new(
points => \@points,
style => "vectors",
);
# Plot the graph
$chart->plot2d($vectors);