© Moritz Lenz 2017

Moritz Lenz, Perl 6 Fundamentals , https://doi.org/10.1007/978-1-4842-2899-9_12

12. Plotting Using Inline::Python and Matplotlib

Moritz Lenz

(1)Fürth, Bayern, Germany

Occasionally I come across git repositories where I want to know how active they are and who the main developers are.

Let’s develop a script that plots the commit history, and explore how to use Python modules in Perl 6.

12.1 Extracting the Stats

We want to plot the number of commits by author and date. We can get this information easily by passing some options to git log:

my $proc = run :out, <git log --date=short --pretty=format:%ad!%an>;my (%total, %by-author, %dates);for $proc.out.lines -> $line {    my ( $date, $author ) = $line.split: '!', 2;    %total{$author}++; ...

Get Perl 6 Fundamentals : A Primer with Examples, Projects, and Case Studies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.