Perl Boxplot and Line Chart example script from the perl graph gallery. Plotly makes free online charts with Perl and PDL and a GUI. Graph of Math Scores Perl Boxplot and Line Chart | Example Code | plotly

Math Scores

Made with Perl graphing API

Back to the API Gallery

Perl Example Code


#!/usr/bin/perl

####################################
# Math Scores Box Plot demo
# Questions? Email feedback@plot.ly
# For more docs, see plot.ly/api
####################################

use strict;
use warnings;

use WebService::Plotly;
use PDL;

use Data::Dumper;


my $plotly = WebService::Plotly->new( un => 'username', key => 'api_key' );


# mean scores
my $mean = [ 80, 85, 81, 89, 94, 96 ];
my $n    = @$mean; # Number of trials
my $ns   = 10;     # Samples per trial

# box plots of normally distributed random data with random standard deviation
# also place the underlying data points next to the box-plot with the 'boxpoints' key
my $x_labels = [ map { "Trial $_" } ( 1 .. $n ) ];

my $trial_data;
foreach my $trial ( 1 .. $n ) {
	push @$trial_data, {
		y => 
	}

}
#trial_data = [
#    {'y': (1+2*random.rand())*random.randn(ns)+mean[i],
#     'name':  x_labels[i],
#     'type': 'box',
#     'boxpoints': 'all', # 'all' | 'outliers' | False
#     'jitter': 0.3,     # the horizontal spread of the 'jittered' points
#     'pointpos': -1.8,  # relative position of the 'jittered' points w.r.t. the box
#     'fillcolor':'rgba(255, 255, 255, 0)', # transparent
#     'line':{'color':'rgb(0, 0, 255)'},
#     'marker':{'color':'rgba(255, 255, 255, 0)',
#        'line':{'color':'black', 'width':1        # refers to the line around the marker
#        }}}
#     for i in range(N)]

#my $response = $plotly->plot( $data, layout => $l );
#
#print "url is:\n\t$response->{url}\n\n";
#print "filename on our server is: \n\t$response->{filename}\n";