Skip to content

Instantly share code, notes, and snippets.

Created July 27, 2017 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/018c83c8d4475953886c594530e4e6af to your computer and use it in GitHub Desktop.
Save anonymous/018c83c8d4475953886c594530e4e6af to your computer and use it in GitHub Desktop.
use v6;
use Text::CSV;
use Graphics::PLplot;
my $csv = Text::CSV.new;
my @dta = csv(in => "thing.csv");
my @points;
my $yMax = 0.00;
for @dta -> @d {
my $x = @d[0] - @dta[0][0];
my $y = @d[1];
{ $yMax = $y } if $y > $yMax;
@points.push: ($x, $y);
}
say $yMax;
say @points[7299][0];
if Graphics::PLplot.new(
device => "png",
file-name => "output.png",
) -> $plot {
$plot.begin;
$plot.environment(
x-range => [0.0, @points[7299][0]],
y-range => [0.0, $yMax],
just => 0,
axis => 0,
);
$plot.label(
x-axis => "Block #",
y-axis => "Price",
title => "Plot",
);
$plot.color-index0(3);
$plot.line(@points);
LEAVE {
$plot.end;
}
}
--------------------------------------------
benji@benji:~/devel/p6/crypto$ perl6 main.pm6
918.054710000000
2909943
This type cannot unbox to a native number: P6opaque, Int
in method line at /home/benji/.perl6/install/share/perl6/site/sources/3DB0A4F1578D92421E11797724D49D325E069AE2 (Graphics::PLplot) line 38
in block <unit> at main.pm6 line 39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment