Skip to content

Instantly share code, notes, and snippets.

@Pabla007
Created June 7, 2019 08:49
Show Gist options
  • Save Pabla007/373e0f705c90c59fa420003dd8778bb2 to your computer and use it in GitHub Desktop.
Save Pabla007/373e0f705c90c59fa420003dd8778bb2 to your computer and use it in GitHub Desktop.
without html
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import bqplot"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"#import json\n",
"import numpy as np\n",
"import bqplot.pyplot as plt\n",
"#from ipywidgets.embed import embed_data\n",
"#from ipywidgets.embed import embed_minimal_html\n",
"#from ipywidgets.embed import embed_minimal_html, dependency_state"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ea8e725fc75a41718960819b1a860b56",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Figure(axes=[Axis(scale=LinearScale()), Axis(orientation='vertical', scale=LinearScale())], fig_margin={'top':…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"size = 100\n",
"scale = 100.\n",
"np.random.seed(0)\n",
"x_data = np.arange(size)\n",
"y_data = np.cumsum(np.random.randn(size) * scale)\n",
"\n",
"fig = plt.figure(title='First Example')\n",
"plt.plot(y_data)\n",
"fig\n",
"#embed_minimal_html('export.html', views=[fig], state=dependency_state([fig]))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {
"00e95b876aad4de78dd3510cfee8d803": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinesModel",
"state": {
"color": {
"type": null,
"values": null
},
"display_legend": false,
"fill_colors": [],
"labels": [
"C1"
],
"scales": {
"x": "IPY_MODEL_24b0b7741ddf4729b189cec7cdc92199",
"y": "IPY_MODEL_a866407db334424fab5b5624bf983a12"
},
"selected": [],
"x": {
"type": "float",
"values": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99
]
},
"y": {
"type": "float",
"values": [
176.4052345967664,
216.42095543348873,
314.29475384406265,
538.3840737642084,
725.1398727792052,
627.4120847915641,
722.4209265441231,
707.2852057143533,
696.9633205349975,
738.0231707288347,
752.4275278449225,
897.8548785412199,
973.9586510559193,
986.1261527052021,
1030.5124759797447,
1063.8799087171715,
1213.2878160329321,
1192.7719896563522,
1224.0787598214422,
1138.6691858912698,
883.3702043078619,
948.7320638518979,
1035.1756837378484,
960.9591816972043,
1187.934644095965,
1042.4980766360886,
1047.0739283662333,
1028.35554336365,
1181.6334647994956,
1328.569341789524,
1344.0640843592157,
1381.8803363194331,
1293.101761556422,
1095.0221147340292,
1060.230899801414,
1075.865796711812,
1198.8948647845841,
1319.1328496630254,
1280.4001679222301,
1250.1698928646965,
1145.3145963579873,
1003.3128026400898,
832.6857835775885,
1027.7633231007674,
976.798104925602,
932.9906747644834,
807.7111387594907,
885.4601743426817,
724.0703895868866,
702.7963615654897,
613.2497054461222,
651.9399552320484,
600.8594414751611,
482.7962230629199,
479.97800022905443,
522.8111872820962,
529.462909520413,
559.7100992943911,
496.2778899262947,
460.00377332758086,
392.75772854998576,
356.80241239593164,
275.48778419148624,
102.85952395831856,
120.60213818369385,
80.42404456286766,
-82.59579013373678,
-36.31756458115937,
-127.04740101948357,
-121.85286143986968,
-48.943805222116,
-36.04551414637493,
77.89455430795515,
-45.58802772741012,
-5.353863609655221,
-73.83487270368654,
-160.91458762187472,
-218.79955409831626,
-249.95480731105351,
-244.33827308807898,
-360.8532571664146,
-270.7706084709959,
-224.20436449794994,
-377.82873312567233,
-229.00351374611236,
-39.41459614305404,
78.46336097291103,
60.47087739167594,
-46.604384759378306,
58.840787933735356,
18.523093236417395,
140.76760027466014,
161.59509808234617,
259.25900173071744,
294.8956414481576,
365.55295826735244,
366.6029603394345,
545.190009730018,
557.88121900038,
598.0801553448503
]
}
}
},
"032cc5aa4c104bf0acdd40c4d35faa29": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"stabilized": false
}
},
"080ce6fd78474296a26e44598eeab26e": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinesModel",
"state": {
"color": {
"type": null,
"values": null
},
"display_legend": false,
"fill_colors": [],
"labels": [
"C1"
],
"scales": {
"x": "IPY_MODEL_bd5f002253d049f79c3b3af524ee9238",
"y": "IPY_MODEL_7d77ad36e9ff41b88b42629e0eaebaf3"
},
"selected": [],
"x": {
"type": "float",
"values": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99
]
},
"y": {
"type": "float",
"values": [
176.4052345967664,
216.42095543348873,
314.29475384406265,
538.3840737642084,
725.1398727792052,
627.4120847915641,
722.4209265441231,
707.2852057143533,
696.9633205349975,
738.0231707288347,
752.4275278449225,
897.8548785412199,
973.9586510559193,
986.1261527052021,
1030.5124759797447,
1063.8799087171715,
1213.2878160329321,
1192.7719896563522,
1224.0787598214422,
1138.6691858912698,
883.3702043078619,
948.7320638518979,
1035.1756837378484,
960.9591816972043,
1187.934644095965,
1042.4980766360886,
1047.0739283662333,
1028.35554336365,
1181.6334647994956,
1328.569341789524,
1344.0640843592157,
1381.8803363194331,
1293.101761556422,
1095.0221147340292,
1060.230899801414,
1075.865796711812,
1198.8948647845841,
1319.1328496630254,
1280.4001679222301,
1250.1698928646965,
1145.3145963579873,
1003.3128026400898,
832.6857835775885,
1027.7633231007674,
976.798104925602,
932.9906747644834,
807.7111387594907,
885.4601743426817,
724.0703895868866,
702.7963615654897,
613.2497054461222,
651.9399552320484,
600.8594414751611,
482.7962230629199,
479.97800022905443,
522.8111872820962,
529.462909520413,
559.7100992943911,
496.2778899262947,
460.00377332758086,
392.75772854998576,
356.80241239593164,
275.48778419148624,
102.85952395831856,
120.60213818369385,
80.42404456286766,
-82.59579013373678,
-36.31756458115937,
-127.04740101948357,
-121.85286143986968,
-48.943805222116,
-36.04551414637493,
77.89455430795515,
-45.58802772741012,
-5.353863609655221,
-73.83487270368654,
-160.91458762187472,
-218.79955409831626,
-249.95480731105351,
-244.33827308807898,
-360.8532571664146,
-270.7706084709959,
-224.20436449794994,
-377.82873312567233,
-229.00351374611236,
-39.41459614305404,
78.46336097291103,
60.47087739167594,
-46.604384759378306,
58.840787933735356,
18.523093236417395,
140.76760027466014,
161.59509808234617,
259.25900173071744,
294.8956414481576,
365.55295826735244,
366.6029603394345,
545.190009730018,
557.88121900038,
598.0801553448503
]
}
}
},
"12a4a40aaa584c9eb6ee6156826b9875": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "AxisModel",
"state": {
"orientation": "vertical",
"scale": "IPY_MODEL_7d77ad36e9ff41b88b42629e0eaebaf3",
"side": "left",
"tick_values": {
"type": null,
"values": null
}
}
},
"169b3f4f157c4f02acae6415a3c577c0": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"allow_padding": false,
"max": 1,
"min": 0,
"stabilized": false
}
},
"18263731679e4d6abac08f9a86facbf1": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"allow_padding": false,
"max": 1,
"min": 0,
"stabilized": false
}
},
"1b97815e68df45aeb97634c94c6e4fd9": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "AxisModel",
"state": {
"orientation": "vertical",
"scale": "IPY_MODEL_488983f0ebad4f40913075cdf219e5eb",
"side": "left",
"tick_values": {
"type": null,
"values": null
}
}
},
"24b0b7741ddf4729b189cec7cdc92199": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"stabilized": false
}
},
"2f8c7029bcbe44289c75310d50b3c6a1": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"allow_padding": false,
"max": 1,
"min": 0,
"stabilized": false
}
},
"3b1b170b2d01404f826252d545fca17b": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "AxisModel",
"state": {
"scale": "IPY_MODEL_bd5f002253d049f79c3b3af524ee9238",
"side": "bottom",
"tick_values": {
"type": null,
"values": null
}
}
},
"3b7c4a8e7fe94799ab763f5d46b36e2a": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"allow_padding": false,
"max": 1,
"min": 0,
"stabilized": false
}
},
"3f020b6fc0ab466b99d87af7f85fe6f1": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "FigureModel",
"state": {
"_dom_classes": [],
"axes": [
"IPY_MODEL_d64bea4a76e74a4ead1f895ebe801bdb",
"IPY_MODEL_5cf6b79269994174b0ef50bcc960a85e"
],
"layout": "IPY_MODEL_5c09972ccf144679b8546c6b5894e49a",
"marks": [
"IPY_MODEL_00e95b876aad4de78dd3510cfee8d803"
],
"scale_x": "IPY_MODEL_bd70a1fac69240b796ba2d6f709e35f2",
"scale_y": "IPY_MODEL_3b7c4a8e7fe94799ab763f5d46b36e2a",
"title": "First Example"
}
},
"488983f0ebad4f40913075cdf219e5eb": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"stabilized": false
}
},
"4d4ce554c06b49a59e4a607183d783c9": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "FigureModel",
"state": {
"_dom_classes": [],
"axes": [
"IPY_MODEL_d8a3274100c94111bb2ee6bec0fb02b2",
"IPY_MODEL_1b97815e68df45aeb97634c94c6e4fd9"
],
"layout": "IPY_MODEL_e841bdb3d88a404fb119d04a18eeb2b9",
"marks": [
"IPY_MODEL_ef74f0e012a947b28d5d63d785a3a1f1"
],
"scale_x": "IPY_MODEL_169b3f4f157c4f02acae6415a3c577c0",
"scale_y": "IPY_MODEL_18263731679e4d6abac08f9a86facbf1",
"title": "First Example"
}
},
"59523600d5234d9594cea128dc63c63d": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"allow_padding": false,
"max": 1,
"min": 0,
"stabilized": false
}
},
"5c09972ccf144679b8546c6b5894e49a": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.1.0",
"model_name": "LayoutModel",
"state": {
"min_width": "125px"
}
},
"5cf6b79269994174b0ef50bcc960a85e": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "AxisModel",
"state": {
"orientation": "vertical",
"scale": "IPY_MODEL_a866407db334424fab5b5624bf983a12",
"side": "left",
"tick_values": {
"type": null,
"values": null
}
}
},
"7d77ad36e9ff41b88b42629e0eaebaf3": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"stabilized": false
}
},
"82bfa92b9e404222a63d94d20409fd22": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.1.0",
"model_name": "LayoutModel",
"state": {
"min_width": "125px"
}
},
"a866407db334424fab5b5624bf983a12": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"stabilized": false
}
},
"bd5f002253d049f79c3b3af524ee9238": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"stabilized": false
}
},
"bd70a1fac69240b796ba2d6f709e35f2": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinearScaleModel",
"state": {
"allow_padding": false,
"max": 1,
"min": 0,
"stabilized": false
}
},
"d64bea4a76e74a4ead1f895ebe801bdb": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "AxisModel",
"state": {
"scale": "IPY_MODEL_24b0b7741ddf4729b189cec7cdc92199",
"side": "bottom",
"tick_values": {
"type": null,
"values": null
}
}
},
"d8a3274100c94111bb2ee6bec0fb02b2": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "AxisModel",
"state": {
"scale": "IPY_MODEL_032cc5aa4c104bf0acdd40c4d35faa29",
"side": "bottom",
"tick_values": {
"type": null,
"values": null
}
}
},
"e841bdb3d88a404fb119d04a18eeb2b9": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.1.0",
"model_name": "LayoutModel",
"state": {
"min_width": "125px"
}
},
"ea8e725fc75a41718960819b1a860b56": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "FigureModel",
"state": {
"_dom_classes": [],
"axes": [
"IPY_MODEL_3b1b170b2d01404f826252d545fca17b",
"IPY_MODEL_12a4a40aaa584c9eb6ee6156826b9875"
],
"layout": "IPY_MODEL_82bfa92b9e404222a63d94d20409fd22",
"marks": [
"IPY_MODEL_080ce6fd78474296a26e44598eeab26e"
],
"scale_x": "IPY_MODEL_59523600d5234d9594cea128dc63c63d",
"scale_y": "IPY_MODEL_2f8c7029bcbe44289c75310d50b3c6a1",
"title": "First Example"
}
},
"ef74f0e012a947b28d5d63d785a3a1f1": {
"model_module": "bqplot",
"model_module_version": "^0.4.5",
"model_name": "LinesModel",
"state": {
"color": {
"type": null,
"values": null
},
"display_legend": false,
"fill_colors": [],
"labels": [
"C1"
],
"scales": {
"x": "IPY_MODEL_032cc5aa4c104bf0acdd40c4d35faa29",
"y": "IPY_MODEL_488983f0ebad4f40913075cdf219e5eb"
},
"selected": [],
"x": {
"type": "float",
"values": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99
]
},
"y": {
"type": "float",
"values": [
176.4052345967664,
216.42095543348873,
314.29475384406265,
538.3840737642084,
725.1398727792052,
627.4120847915641,
722.4209265441231,
707.2852057143533,
696.9633205349975,
738.0231707288347,
752.4275278449225,
897.8548785412199,
973.9586510559193,
986.1261527052021,
1030.5124759797447,
1063.8799087171715,
1213.2878160329321,
1192.7719896563522,
1224.0787598214422,
1138.6691858912698,
883.3702043078619,
948.7320638518979,
1035.1756837378484,
960.9591816972043,
1187.934644095965,
1042.4980766360886,
1047.0739283662333,
1028.35554336365,
1181.6334647994956,
1328.569341789524,
1344.0640843592157,
1381.8803363194331,
1293.101761556422,
1095.0221147340292,
1060.230899801414,
1075.865796711812,
1198.8948647845841,
1319.1328496630254,
1280.4001679222301,
1250.1698928646965,
1145.3145963579873,
1003.3128026400898,
832.6857835775885,
1027.7633231007674,
976.798104925602,
932.9906747644834,
807.7111387594907,
885.4601743426817,
724.0703895868866,
702.7963615654897,
613.2497054461222,
651.9399552320484,
600.8594414751611,
482.7962230629199,
479.97800022905443,
522.8111872820962,
529.462909520413,
559.7100992943911,
496.2778899262947,
460.00377332758086,
392.75772854998576,
356.80241239593164,
275.48778419148624,
102.85952395831856,
120.60213818369385,
80.42404456286766,
-82.59579013373678,
-36.31756458115937,
-127.04740101948357,
-121.85286143986968,
-48.943805222116,
-36.04551414637493,
77.89455430795515,
-45.58802772741012,
-5.353863609655221,
-73.83487270368654,
-160.91458762187472,
-218.79955409831626,
-249.95480731105351,
-244.33827308807898,
-360.8532571664146,
-270.7706084709959,
-224.20436449794994,
-377.82873312567233,
-229.00351374611236,
-39.41459614305404,
78.46336097291103,
60.47087739167594,
-46.604384759378306,
58.840787933735356,
18.523093236417395,
140.76760027466014,
161.59509808234617,
259.25900173071744,
294.8956414481576,
365.55295826735244,
366.6029603394345,
545.190009730018,
557.88121900038,
598.0801553448503
]
}
}
}
},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment