Skip to content

Commit 8961d99

Browse files
committed
added tutorial 5 and 6
1 parent f384842 commit 8961d99

File tree

3 files changed

+142
-1
lines changed

3 files changed

+142
-1
lines changed

tutorials/tutorial_01.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
],
7373
"metadata": {
7474
"kernelspec": {
75-
"display_name": "env_maxplotlib",
75+
"display_name": "Python 3 (ipykernel)",
7676
"language": "python",
7777
"name": "python3"
7878
},

tutorials/tutorial_05.ipynb

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "0",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"import numpy as np\n",
11+
"\n",
12+
"import maxplotlib.canvas.canvas as canvas\n",
13+
"%load_ext autoreload\n",
14+
"%autoreload 2"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": null,
20+
"id": "1",
21+
"metadata": {},
22+
"outputs": [],
23+
"source": [
24+
"c = canvas.Canvas(width=\"17cm\", ratio=0.5)\n",
25+
"sp = c.add_subplot(grid=True, xlabel=\"x\", ylabel=\"y\")\n",
26+
"\n",
27+
"node_a = sp.add_node(\n",
28+
" 0, 0, \"A\", content=\"Node A\", shape=\"circle\", draw=\"black\", fill=\"blue!20\"\n",
29+
")\n",
30+
"node_b = sp.add_node(\n",
31+
" 1, 1, \"B\", content=\"Node B\", shape=\"circle\", draw=\"black\", fill=\"blue!20\"\n",
32+
")\n",
33+
"# sp.add_node(2, 2, 'B', content=\"$a^2 + b^2 = c^2$\", shape='rectangle', draw='red', fill='white', layer=1)\n",
34+
"# sp.add_node(2, 5, 'C', shape='rectangle', draw='red', fill='red')\n",
35+
"# last_node = sp.add_node(-1, 5, shape='rectangle', draw='red', fill='red', layer=-10)\n",
36+
"\n",
37+
"# Add a line between nodes\n",
38+
"sp.add_path([\"A\", \"B\"], color=\"green\", style=\"solid\", line_width=\"2\", layer=-5)\n",
39+
"\n",
40+
"x = np.arange(0, 2 * np.pi, 0.01)\n",
41+
"y = np.sin(x)\n",
42+
"sp.add_line(x, y, label=r\"$\\sin(x)$\")\n",
43+
"# c.plot()\n",
44+
"c.savefig(filename=\"tutorial_05_01.pdf\")"
45+
]
46+
},
47+
{
48+
"cell_type": "code",
49+
"execution_count": null,
50+
"id": "2",
51+
"metadata": {},
52+
"outputs": [],
53+
"source": []
54+
}
55+
],
56+
"metadata": {
57+
"kernelspec": {
58+
"display_name": "Python 3 (ipykernel)",
59+
"language": "python",
60+
"name": "python3"
61+
},
62+
"language_info": {
63+
"codemirror_mode": {
64+
"name": "ipython",
65+
"version": 3
66+
},
67+
"file_extension": ".py",
68+
"mimetype": "text/x-python",
69+
"name": "python",
70+
"nbconvert_exporter": "python",
71+
"pygments_lexer": "ipython3",
72+
"version": "3.13.3"
73+
}
74+
},
75+
"nbformat": 4,
76+
"nbformat_minor": 5
77+
}

tutorials/tutorial_06.ipynb

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "0",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"import maxplotlib.canvas.canvas as canvas\n",
11+
"import matplotlib.pyplot as plt\n",
12+
"import numpy as np\n",
13+
"\n",
14+
"%load_ext autoreload\n",
15+
"%autoreload 2"
16+
]
17+
},
18+
{
19+
"cell_type": "code",
20+
"execution_count": null,
21+
"id": "1",
22+
"metadata": {},
23+
"outputs": [],
24+
"source": [
25+
"c = canvas.Canvas(width=\"17cm\", ratio=0.5)\n",
26+
"sp = c.add_subplot(grid=False, xlabel=\"x\", ylabel=\"y\")\n",
27+
"# sp.add_line([0, 1, 2, 3], [0, 1, 4, 9], label=\"Line 1\",layer=1)\n",
28+
"data = np.random.random((10, 10))\n",
29+
"sp.add_imshow(data, extent=[1, 10, 1, 20], layer=1)\n",
30+
"# c.plot()\n",
31+
"c.savefig(layer_by_layer=True, filename=\"tutorial_06_01.pdf\")"
32+
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": null,
37+
"id": "2",
38+
"metadata": {},
39+
"outputs": [],
40+
"source": []
41+
}
42+
],
43+
"metadata": {
44+
"kernelspec": {
45+
"display_name": "Python 3 (ipykernel)",
46+
"language": "python",
47+
"name": "python3"
48+
},
49+
"language_info": {
50+
"codemirror_mode": {
51+
"name": "ipython",
52+
"version": 3
53+
},
54+
"file_extension": ".py",
55+
"mimetype": "text/x-python",
56+
"name": "python",
57+
"nbconvert_exporter": "python",
58+
"pygments_lexer": "ipython3",
59+
"version": "3.13.3"
60+
}
61+
},
62+
"nbformat": 4,
63+
"nbformat_minor": 5
64+
}

0 commit comments

Comments
 (0)