Giter Site home page Giter Site logo

perl6-graphics-plplot's Introduction

Graphics::PLplot

Build Status Build status

This module provides Perl 6 low and high-level native bindings for PLplot.

Note: Currently work in progress and the API is being implemented one brick at a time. Help and feedback is appreciated.

PLplot is a library of subroutines that are often used to make scientific plots in various compiled languages. PLplot can also be used interactively by interpreted languages such as Octave, Python, Perl and Tcl. The current version was written primarily by Maurice J. LeBrun and Geoffrey Furnish and is licensed under LGPL.

Example

use v6;
use Graphics::PLplot;

if Graphics::PLplot.new(
    device    => "png",
    file-name => "output.png"
) -> $plot  {

    # Begin plotting
    $plot.begin;

    # Create a labeled box to hold the plot.
    my $y-max = 100;
    $plot.environment(
        x-range => [0.0, 1.0],
        y-range => [0.0, $y-max],
        just    => 0,
        axis    => 0,
   );
    $plot.label(
        x-axis => "x",
        y-axis => "y=100 x#u2#d",
        title  => "Simple PLplot demo of a 2D line plot",
   );

    # Prepare data to be plotted.
    constant NSIZE = 101;
    my @points = gather {
        for 0..^NSIZE -> $i {
            my $x = Num($i) / (NSIZE - 1);
            my $y = Num($y-max * $x * $x);
            take ($x, $y);
        }
    };

    # Plot the data that was prepared above.
    $plot.line(@points);

    LEAVE {
        $plot.end;
    }
}

For more examples, please see the examples folder.

Installation

  • On Debian-based linux distributions, please use the following command:
$ sudo apt install libplplot-dev
  • On Mac OS X, please use the following command:
$ brew update
$ brew install plplot
  • Using zef (a module management tool bundled with Rakudo Star):
$ zef install Graphics::PLplot

Testing

  • To run tests:
$ prove -ve "perl6 -Ilib"
  • To run all tests including author tests (Please make sure Test::Meta is installed):
$ zef install Test::META
$ AUTHOR_TESTING=1 prove -e "perl6 -Ilib"

Author

Ahmad M. Zawawi, azawawi on #perl6, https://github.com/azawawi/

License

MIT

perl6-graphics-plplot's People

Contributors

azawawi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.