rbplotly 0.1.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +64 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +176 -51
  5. data/lib/plotly/assets/plotly.min.js +3620 -0
  6. data/lib/plotly/attributes.rb +221 -0
  7. data/lib/plotly/figure.rb +236 -0
  8. data/lib/plotly/html.rb +150 -0
  9. data/lib/plotly/plot.rb +11 -28
  10. data/lib/plotly/schema/plot-schema.json +57234 -0
  11. data/lib/plotly/schema.rb +96 -0
  12. data/lib/plotly/serializer.rb +49 -0
  13. data/lib/plotly/subplots.rb +118 -0
  14. data/lib/plotly/version.rb +7 -1
  15. data/lib/plotly.rb +21 -0
  16. data/lib/rbplotly.rb +3 -4
  17. metadata +34 -179
  18. data/.gitignore +0 -11
  19. data/.rspec +0 -2
  20. data/.rubocop.yml +0 -22
  21. data/.travis.yml +0 -9
  22. data/CODE_OF_CONDUCT.md +0 -49
  23. data/Gemfile +0 -4
  24. data/Guardfile +0 -12
  25. data/Rakefile +0 -9
  26. data/bin/console +0 -14
  27. data/bin/setup +0 -8
  28. data/docs/images/line_chart.png +0 -0
  29. data/examples/Bar Charts.ipynb +0 -254
  30. data/examples/Basic Usage.ipynb +0 -227
  31. data/examples/Histograms.ipynb +0 -79
  32. data/examples/Line charts.ipynb +0 -88
  33. data/examples/Pie Charts.ipynb +0 -151
  34. data/examples/Scatter Plots.ipynb +0 -224
  35. data/examples/heatmaps.ipynb +0 -150
  36. data/lib/plotly/axis.rb +0 -18
  37. data/lib/plotly/castable.rb +0 -20
  38. data/lib/plotly/client.rb +0 -45
  39. data/lib/plotly/data.rb +0 -33
  40. data/lib/plotly/exportable.rb +0 -23
  41. data/lib/plotly/layout.rb +0 -33
  42. data/lib/plotly/line.rb +0 -17
  43. data/lib/plotly/marker.rb +0 -23
  44. data/lib/plotly/offline/exportable.rb +0 -36
  45. data/lib/plotly/offline/html.rb +0 -46
  46. data/lib/plotly/offline/plotly.min.js +0 -59
  47. data/lib/plotly/offline/templates/body.erb +0 -26
  48. data/lib/plotly/offline/templates/plot.erb +0 -12
  49. data/lib/plotly/util.rb +0 -11
  50. data/rbplotly.gemspec +0 -35
data/Rakefile DELETED
@@ -1,9 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require 'rubocop/rake_task'
4
-
5
- RSpec::Core::RakeTask.new(:spec)
6
- RuboCop::RakeTask.new(:style)
7
-
8
- task default: :spec
9
- task ci: [:spec, :style]
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'rbplotly'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require 'pry'
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
Binary file
@@ -1,254 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 1,
6
- "metadata": {
7
- "collapsed": false
8
- },
9
- "outputs": [
10
- {
11
- "data": {
12
- "text/html": [
13
- "\n",
14
- " <script>\n",
15
- " requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})\n",
16
- " </script>\n",
17
- "\n",
18
- "\n",
19
- "<div id=\"15364e44-e887-419b-baf4-95d87b7f3345\" style=\"height: 100%; width: 100%;\"></div>\n",
20
- "\n",
21
- "<script>\n",
22
- " require(['plotly'], function(Plotly) { \n",
23
- "Plotly.newPlot(\n",
24
- " '15364e44-e887-419b-baf4-95d87b7f3345',\n",
25
- " [{\"x\":[\"giraffes\",\"orangutans\",\"monkeys\"],\"y\":[20,14,23],\"type\":\"bar\"}],\n",
26
- " {},\n",
27
- " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
28
- ")\n",
29
- "\n",
30
- "window.addEventListener('resize', function() {\n",
31
- " Plotly.Plots.resize(document.getElementById('15364e44-e887-419b-baf4-95d87b7f3345'))\n",
32
- "})\n",
33
- " }) \n",
34
- "</script>"
35
- ],
36
- "text/plain": [
37
- "#<Plotly::Offline::HTML:0x007f99a3875f20 @id=\"15364e44-e887-419b-baf4-95d87b7f3345\", @data=[{:x=>[\"giraffes\", \"orangutans\", \"monkeys\"], :y=>[20, 14, 23], :type=>:bar}], @layout={}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
38
- ]
39
- },
40
- "metadata": {},
41
- "output_type": "display_data"
42
- }
43
- ],
44
- "source": [
45
- "# Basic Bar Chart\n",
46
- "require 'rbplotly'\n",
47
- "\n",
48
- "trace = { \n",
49
- " x: %w(giraffes orangutans monkeys),\n",
50
- " y: [20, 14, 23],\n",
51
- " type: :bar\n",
52
- "}\n",
53
- "\n",
54
- "plot = Plotly::Plot.new(data: [trace])\n",
55
- "plot.show"
56
- ]
57
- },
58
- {
59
- "cell_type": "code",
60
- "execution_count": 2,
61
- "metadata": {
62
- "collapsed": false
63
- },
64
- "outputs": [
65
- {
66
- "data": {
67
- "text/html": [
68
- "\n",
69
- " <script>\n",
70
- " requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})\n",
71
- " </script>\n",
72
- "\n",
73
- "\n",
74
- "<div id=\"c4af18d6-ca92-4bd0-8e5a-1fe6b3bcc084\" style=\"height: 100%; width: 100%;\"></div>\n",
75
- "\n",
76
- "<script>\n",
77
- " require(['plotly'], function(Plotly) { \n",
78
- "Plotly.newPlot(\n",
79
- " 'c4af18d6-ca92-4bd0-8e5a-1fe6b3bcc084',\n",
80
- " [{\"x\":[\"giraffes\",\"orangutans\",\"monkeys\"],\"y\":[20,14,23],\"type\":\"bar\",\"name\":\"SF Zoo\"},{\"x\":[\"giraffes\",\"orangutans\",\"monkeys\"],\"y\":[12,18,29],\"type\":\"bar\",\"name\":\"LA Zoo\"}],\n",
81
- " {},\n",
82
- " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
83
- ")\n",
84
- "\n",
85
- "window.addEventListener('resize', function() {\n",
86
- " Plotly.Plots.resize(document.getElementById('c4af18d6-ca92-4bd0-8e5a-1fe6b3bcc084'))\n",
87
- "})\n",
88
- " }) \n",
89
- "</script>"
90
- ],
91
- "text/plain": [
92
- "#<Plotly::Offline::HTML:0x007f99a301e458 @id=\"c4af18d6-ca92-4bd0-8e5a-1fe6b3bcc084\", @data=[{:x=>[\"giraffes\", \"orangutans\", \"monkeys\"], :y=>[20, 14, 23], :type=>:bar, :name=>\"SF Zoo\"}, {:x=>[\"giraffes\", \"orangutans\", \"monkeys\"], :y=>[12, 18, 29], :type=>:bar, :name=>\"LA Zoo\"}], @layout={}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
93
- ]
94
- },
95
- "metadata": {},
96
- "output_type": "display_data"
97
- }
98
- ],
99
- "source": [
100
- "# Grouped Bar Chart\n",
101
- "require 'rbplotly'\n",
102
- "\n",
103
- "trace1 = {\n",
104
- " x: %w(giraffes orangutans monkeys),\n",
105
- " y: [20, 14, 23],\n",
106
- " type: :bar,\n",
107
- " name: 'SF Zoo'\n",
108
- "}\n",
109
- "trace2 = {\n",
110
- " x: %w(giraffes orangutans monkeys),\n",
111
- " y: [12, 18, 29],\n",
112
- " type: :bar,\n",
113
- " name: 'LA Zoo'\n",
114
- "}\n",
115
- "\n",
116
- "plot = Plotly::Plot.new(data: [trace1, trace2])\n",
117
- "plot.show"
118
- ]
119
- },
120
- {
121
- "cell_type": "code",
122
- "execution_count": 3,
123
- "metadata": {
124
- "collapsed": false
125
- },
126
- "outputs": [
127
- {
128
- "data": {
129
- "text/html": [
130
- "\n",
131
- " <script>\n",
132
- " requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})\n",
133
- " </script>\n",
134
- "\n",
135
- "\n",
136
- "<div id=\"0fc03d39-3ef1-4d46-a2de-286272798cd1\" style=\"height: 100%; width: 100%;\"></div>\n",
137
- "\n",
138
- "<script>\n",
139
- " require(['plotly'], function(Plotly) { \n",
140
- "Plotly.newPlot(\n",
141
- " '0fc03d39-3ef1-4d46-a2de-286272798cd1',\n",
142
- " [{\"x\":[\"giraffes\",\"orangutans\",\"monkeys\"],\"y\":[20,14,23],\"type\":\"bar\",\"name\":\"SF Zoo\"},{\"x\":[\"giraffes\",\"orangutans\",\"monkeys\"],\"y\":[12,18,29],\"type\":\"bar\",\"name\":\"LA Zoo\"}],\n",
143
- " {\"barmode\":\"stack\"},\n",
144
- " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
145
- ")\n",
146
- "\n",
147
- "window.addEventListener('resize', function() {\n",
148
- " Plotly.Plots.resize(document.getElementById('0fc03d39-3ef1-4d46-a2de-286272798cd1'))\n",
149
- "})\n",
150
- " }) \n",
151
- "</script>"
152
- ],
153
- "text/plain": [
154
- "#<Plotly::Offline::HTML:0x007f99a32c9720 @id=\"0fc03d39-3ef1-4d46-a2de-286272798cd1\", @data=[{:x=>[\"giraffes\", \"orangutans\", \"monkeys\"], :y=>[20, 14, 23], :type=>:bar, :name=>\"SF Zoo\"}, {:x=>[\"giraffes\", \"orangutans\", \"monkeys\"], :y=>[12, 18, 29], :type=>:bar, :name=>\"LA Zoo\"}], @layout={:barmode=>:stack}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
155
- ]
156
- },
157
- "metadata": {},
158
- "output_type": "display_data"
159
- }
160
- ],
161
- "source": [
162
- "# Grouped to Stacked\n",
163
- "plot.layout.barmode = :stack\n",
164
- "plot.show"
165
- ]
166
- },
167
- {
168
- "cell_type": "code",
169
- "execution_count": 4,
170
- "metadata": {
171
- "collapsed": false
172
- },
173
- "outputs": [
174
- {
175
- "data": {
176
- "text/html": [
177
- "\n",
178
- " <script>\n",
179
- " requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})\n",
180
- " </script>\n",
181
- "\n",
182
- "\n",
183
- "<div id=\"83a0745a-84f0-4cd3-be13-af2a424a08f5\" style=\"height: 100%; width: 100%;\"></div>\n",
184
- "\n",
185
- "<script>\n",
186
- " require(['plotly'], function(Plotly) { \n",
187
- "Plotly.newPlot(\n",
188
- " '83a0745a-84f0-4cd3-be13-af2a424a08f5',\n",
189
- " [{\"x\":[\"giraffes\",\"orangutans\",\"monkeys\"],\"y\":[20,14,23],\"type\":\"bar\",\"name\":\"SF Zoo\"},{\"x\":[\"giraffes\",\"orangutans\",\"monkeys\"],\"y\":[12,18,29],\"type\":\"bar\",\"name\":\"LA Zoo\"}],\n",
190
- " {\"barmode\":\"stack\"},\n",
191
- " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
192
- ")\n",
193
- "\n",
194
- "window.addEventListener('resize', function() {\n",
195
- " Plotly.Plots.resize(document.getElementById('83a0745a-84f0-4cd3-be13-af2a424a08f5'))\n",
196
- "})\n",
197
- " }) \n",
198
- "</script>"
199
- ],
200
- "text/plain": [
201
- "#<Plotly::Offline::HTML:0x007f99a3e19cb0 @id=\"83a0745a-84f0-4cd3-be13-af2a424a08f5\", @data=[{:x=>[\"giraffes\", \"orangutans\", \"monkeys\"], :y=>[20, 14, 23], :type=>:bar, :name=>\"SF Zoo\"}, {:x=>[\"giraffes\", \"orangutans\", \"monkeys\"], :y=>[12, 18, 29], :type=>:bar, :name=>\"LA Zoo\"}], @layout={:barmode=>:stack}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
202
- ]
203
- },
204
- "metadata": {},
205
- "output_type": "display_data"
206
- }
207
- ],
208
- "source": [
209
- "# Stacked Bar Chart\n",
210
- "require 'rbplotly'\n",
211
- "\n",
212
- "trace1 = {\n",
213
- " x: %w(giraffes orangutans monkeys),\n",
214
- " y: [20, 14, 23],\n",
215
- " type: :bar,\n",
216
- " name: 'SF Zoo'\n",
217
- "}\n",
218
- "trace2 = {\n",
219
- " x: %w(giraffes orangutans monkeys),\n",
220
- " y: [12, 18, 29],\n",
221
- " type: :bar,\n",
222
- " name: 'LA Zoo'\n",
223
- "}\n",
224
- "\n",
225
- "plot = Plotly::Plot.new(data: [trace1, trace2], layout: { barmode: :stack } )\n",
226
- "plot.show"
227
- ]
228
- },
229
- {
230
- "cell_type": "code",
231
- "execution_count": null,
232
- "metadata": {
233
- "collapsed": true
234
- },
235
- "outputs": [],
236
- "source": []
237
- }
238
- ],
239
- "metadata": {
240
- "kernelspec": {
241
- "display_name": "Ruby 2.3.1",
242
- "language": "ruby",
243
- "name": "ruby"
244
- },
245
- "language_info": {
246
- "file_extension": ".rb",
247
- "mimetype": "application/x-ruby",
248
- "name": "ruby",
249
- "version": "2.3.1"
250
- }
251
- },
252
- "nbformat": 4,
253
- "nbformat_minor": 1
254
- }