Created
July 27, 2017 00:14
-
-
Save anonymous/018c83c8d4475953886c594530e4e6af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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