Dirk Krause
and 1 contributors


LaTeX::PGF::Diagram2D::Polyline - Perl extension for drawing 2D diagrams (polyline).


  use LaTeX::PGF::Diagram2D;
  my $Uq = 1.0;
  my $Ri = 4.0;
  sub I($)
    my $RL = shift;
    my $back = $Uq / ($Ri + $RL);
    return $back;
  # 10 centimeters wide, 6 centimeters high 
  my $d = LaTeX::PGF::Diagram2D->new(10.0, 6.0);
  # R (on the x axis) is in the range 0 ... 10
  $d->axis('b')->set_linear(0.0, 10.0)->set_grid_step(1.0)
  # I (on the y axis) is in the range 0 ... 0,3
  $d->axis('l')->set_linear(0.0,  0.3)->set_grid_step(0.05)
  my $p = $d->plot('b', 'l');

  my @polylinepoints = (
    0.0, 0.0,
    1.0, 0.3,
    2.0, 0.0,
    3.0, 0.3,
    4.0, 0.0
  my $l = $d->polyine('b', 'l', \@polylinepoints);



Each object of the LaTeX::PGF::Diagram2D::Label class represents one additional polyline drawn in the plot. The LaTeX::PGF::Diagram2D object's polyline() method creates a new LaTeX::PGF::Diagram2D::Polyline object and returns a reference to it. This reference can be used for further setup (setting the color and width).

The set_color() method can be used to set the label color, use a LaTeX color description as argument.

The set_width() method can be used to set the width. The argument is a factor, n times the width of drawed curves.


None by default.



Dirk Krause, <krause@localdomain>


Copyright (C) 2011 by Dirk Krause

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.