Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 9d38f9d

Browse files
committed
initial sketch
1 parent b3ff13f commit 9d38f9d

File tree

5 files changed

+574
-32
lines changed

5 files changed

+574
-32
lines changed

META.json

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"abstract" : "#",
2+
"abstract" : "access plot.ly programmatically",
33
"author" : [
4-
"Christian Walde <[email protected]>"
4+
"Christian Walde <[email protected]>",
5+
"Christopher Parmer <[email protected]>"
56
],
67
"dynamic_config" : 0,
7-
"generated_by" : "Dist::Zilla version 4.300006, CPAN::Meta::Converter version 2.113640",
8+
"generated_by" : "Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.131560",
89
"license" : [
9-
"unrestricted"
10+
"mit"
1011
],
1112
"meta-spec" : {
1213
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
@@ -30,27 +31,41 @@
3031
"ExtUtils::MakeMaker" : "6.30"
3132
}
3233
},
34+
"develop" : {
35+
"requires" : {
36+
"Pod::Coverage::TrustPod" : "0",
37+
"Test::CPAN::Meta" : "0",
38+
"Test::Pod" : "1.41",
39+
"Test::Pod::Coverage" : "1.08"
40+
}
41+
},
3342
"runtime" : {
3443
"requires" : {
44+
"JSON" : "0",
45+
"LWP::UserAgent" : "0",
46+
"Moo" : "0",
3547
"perl" : "5.006",
36-
"strictures" : 0
48+
"strictures" : "0",
49+
"warnings" : "0"
3750
}
3851
},
3952
"test" : {
4053
"requires" : {
41-
"File::Find" : 0,
42-
"File::Temp" : 0,
43-
"Test::InDistDir" : 0,
44-
"Test::More" : 0,
45-
"strict" : 0,
46-
"warnings" : 0
54+
"Capture::Tiny" : "0",
55+
"File::Find" : "0",
56+
"File::Temp" : "0",
57+
"PDL::Constants" : "0",
58+
"Test::Fatal" : "0",
59+
"Test::InDistDir" : "0",
60+
"Test::More" : "0",
61+
"strict" : "0"
4762
}
4863
}
4964
},
5065
"provides" : {
5166
"WebService::Plotly" : {
5267
"file" : "lib/WebService/Plotly.pm",
53-
"version" : "0.000001"
68+
"version" : "1.132820"
5469
}
5570
},
5671
"release_status" : "stable",
@@ -59,13 +74,13 @@
5974
"mailto" : "bug-webservice-plotly at rt.cpan.org",
6075
"web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=WebService-Plotly"
6176
},
62-
"homepage" : "https://github.com/wchristian/webservice-plotly",
77+
"homepage" : "https://github.com/cparmer/plotlyperl",
6378
"repository" : {
6479
"type" : "git",
65-
"url" : "https://github.com/wchristian/webservice-plotly.git",
66-
"web" : "https://github.com/wchristian/webservice-plotly"
80+
"url" : "https://github.com/cparmer/plotlyperl.git",
81+
"web" : "https://github.com/cparmer/plotlyperl"
6782
}
6883
},
69-
"version" : "0.000001"
84+
"version" : "1.132820"
7085
}
7186

README.pod

Lines changed: 142 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,131 @@
11
=head1 NAME
22

3-
WebService::Plotly
3+
WebService::Plotly - access plot.ly programmatically
44

55
=head1 VERSION
66

7-
version 0.000001
7+
version 1.132820
8+
9+
=head1 SYNOPSIS
10+
11+
use WebService::Plotly;
12+
13+
my $user = USERNAME_HERE;
14+
my $login = WebService::Plotly->signup( $user, EMAIL_HERE );
15+
warn "temp password is $login->{tmp_pw}";
16+
17+
my $plotly = WebService::Plotly->new( un => $user, key => $login->{api_key} );
18+
19+
my $x0 = [ 1, 2, 3, 4 ];
20+
my $y0 = [ 10, 15, 13, 17 ];
21+
my $x1 = [ 2, 3, 4, 5 ];
22+
my $y1 = [ 16, 5, 11, 9 ];
23+
my $response = $plotly->plot( $x0, $y0, $x1, $y1 );
24+
25+
print "url is: $response->{url}";
26+
print "filename on our server is: $response->{filename}";
27+
28+
=head1 DESCRIPTION
29+
30+
This module provides a smooth interface to the REST API of L<http://plot.ly>. It
31+
will take both plain perl data as well as PDL objects and transform them as
32+
needed.
33+
34+
Note that WS::Plotly caches the filename on the plotly server inside the object,
35+
so that further plot/style/layout calls can be used to modified an existing
36+
plot.
37+
38+
=head1 CONSTRUCTOR
39+
40+
WS::Plotly uses a standard Moo constructor.
41+
42+
=head1 ATTRIBUTES
43+
44+
=head2 un
45+
46+
Expects a string containing the username to be sent to the API for
47+
authentification.
48+
49+
Required attribute.
50+
51+
=head2 key
52+
53+
Expects a string containing the API key to be sent to the API for
54+
authentification.
55+
56+
Required attribute.
57+
58+
=head2 fileopt
59+
60+
Expects a string containing options sent to the API with every data call,
61+
concerning usage of the filename parameter. See the bottom of
62+
L<https://plot.ly/api/>.
63+
64+
=head2 filename
65+
66+
Expects a string containing options sent to the API with every data call,
67+
determining the name for the plot resulting of the call, or a name of the plot
68+
to be reused for this call.
69+
70+
=head2 verbose
71+
72+
Boolean that determines whether the server message (containing the plot url and
73+
filename) will be printed to the console. Defaults to 1.
74+
75+
=head1 METHODS
76+
77+
=head2 version
78+
79+
Returns the version of the API object, which will be sent to the API.
80+
81+
=head2 my $response = $plotly->signup( $username, $email )
82+
83+
Creates a new account on the server, if possible. Returns a hash containing the
84+
temporary password of the new account, as well as the api key.
85+
86+
=head3 DATA CALLS
87+
88+
All of these calls take arguments in this fashion:
89+
90+
$plotly->plot( @data, %options );
91+
92+
Beginning from the start of the argument list all elements will be slurped into
93+
a data array (they're generally expected to be array references or PDL objects)
94+
until the first scalar with a ref() value is reached.
95+
96+
This is assumed to be a hash key and it along with all following scalars will be
97+
slurped into an option hash.
98+
99+
This means that the data calls generally do not care if they are sent an array
100+
reference containing a list of data array referencess as the first argument, or
101+
a flat list of data array references.
102+
103+
All of the data calls return a response hash containing the keys url, message,
104+
warning, filename and error. Normally only url and filename will be interesting
105+
to you; however message can contain extra information and will be printed if
106+
verbose is set to 1, warning can contain warnings from the server and is always
107+
printed with warn(), while a value in the error key triggers the module to die.
108+
109+
These data calls exist and reading the documentation at the bottom of
110+
L<https://plot.ly/api/> is recommended.
111+
112+
=head2 plot
113+
114+
This sends data to Plotly to be plotted and stored.
115+
116+
=head2 style
117+
118+
This call is used to style the data sets sent to the server with the plot call.
119+
120+
=head2 layout
121+
122+
This call customizes the style of the layout, the axes, and the legend.
123+
124+
=head1 THANKS
125+
126+
Many thanks for Christopher Parmer specifically and Plotly, Inc. in general for
127+
providing much support and help in creating this module, as well as footing the
128+
bill for it.
8129

9130
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
10131

@@ -21,20 +142,29 @@ You will be notified automatically of any progress on your issue.
21142
This is open source software. The code repository is available for
22143
public review and contribution under the terms of the license.
23144

24-
L<https://github.com/wchristian/webservice-plotly>
145+
L<https://github.com/cparmer/plotlyperl>
146+
147+
git clone https://github.com/cparmer/plotlyperl.git
25148

26-
git clone https://github.com/wchristian/webservice-plotly.git
149+
=head1 AUTHORS
27150

28-
=head1 AUTHOR
151+
=over 4
29152

30-
Christian Walde <[email protected]>
153+
=item *
154+
155+
Christian Walde <[email protected]>
156+
157+
=item *
158+
159+
Christopher Parmer <[email protected]>
160+
161+
=back
31162

32163
=head1 COPYRIGHT AND LICENSE
33164

34-
Christian Walde has dedicated the work to the Commons by waiving all of his
35-
or her rights to the work worldwide under copyright law and all related or
36-
neighboring legal rights he or she had in the work, to the extent allowable by
37-
law.
165+
This software is Copyright (c) 2013 by Plotly, Inc..
166+
167+
This is free software, licensed under:
168+
169+
The MIT (X11) License
38170

39-
Works under CC0 do not require attribution. When citing the work, you should
40-
not imply endorsement by the author.

dist.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name = WebService-Plotly
2-
author = Christian Walde <[email protected]>
3-
license = CC0_1_0
4-
copyright_holder = Christian Walde
2+
author = Christian Walde <[email protected]>
3+
author = Christopher Parmer <[email protected]>
4+
license = MIT
5+
copyright_holder = Plotly, Inc.
56
copyright_year = 2013
67

78
[@MITHALDU]

0 commit comments

Comments
 (0)