Skip to content

Commit d39d967

Browse files
committed
Updated tutorials
1 parent a32587c commit d39d967

File tree

2 files changed

+57
-60
lines changed

2 files changed

+57
-60
lines changed

tutorials/tutorial_02.ipynb

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,25 @@
1515
},
1616
{
1717
"cell_type": "code",
18-
"execution_count": 23,
18+
"execution_count": 64,
1919
"id": "650f0afa-f719-4495-b020-fc2b2df36bd7",
2020
"metadata": {},
2121
"outputs": [
2222
{
2323
"name": "stdout",
2424
"output_type": "stream",
2525
"text": [
26-
"A\n",
2726
"\\begin{tikzpicture}\n",
28-
" \\node[shape={circle}, draw={black}, fill={blue!20}] (A) at (0, 0) {Origin node};\n",
29-
" \\node[shape={rectangle}, draw={red}] (B) at (2, 2) {};\n",
30-
" \\node[shape={rectangle}, draw={red}] (C) at (2, 5) {};\n",
31-
" \\node[shape={rectangle}, draw={red}] (node3) at (-1, 5) {};\n",
32-
" \\draw[color={green}, style={solid}, line width={2pt}] (A) -- (B) -- (C) -- (A) -- (node3);\n",
27+
"\n",
28+
" % Layer 0\n",
29+
" \\node (A) at (0, 0) {};\n",
30+
" \\node (B) at (1, 0) {};\n",
31+
" \\node (C) at (1, 1) {};\n",
32+
" \\node (D) at (0, 1) {};\n",
33+
" \\draw[draw, rounded corners, fill=red, opacity=0.5] (A.center) -- (B.center) -- (C.center) -- (D.center) -- cycle;\n",
34+
"\n",
35+
" % Layer 2\n",
36+
" \\node (node4) at (0.5, 0.5) {Cube};\n",
3337
"\\end{tikzpicture}\n",
3438
"PDF successfully compiled and saved as 'my_figure.pdf'.\n"
3539
]
@@ -40,15 +44,14 @@
4044
"tikz = c.add_tikzfigure(grid=False)\n",
4145
"\n",
4246
"# Add nodes\n",
43-
"node_a = tikz.add_node(0, 0, 'A', content='Origin node', shape='circle', draw='black', fill='blue!20')\n",
44-
"tikz.add_node(2, 2, 'B', shape='rectangle', draw='red')\n",
45-
"tikz.add_node(2, 5, 'C', shape='rectangle', draw='red')\n",
46-
"last_node = tikz.add_node(-1, 5, shape='rectangle', draw='red')\n",
47-
"\n",
48-
"print(node_a.label)\n",
47+
"tikz.add_node(0, 0, 'A')\n",
48+
"tikz.add_node(1, 0, 'B')\n",
49+
"tikz.add_node(1, 1, 'C')\n",
50+
"tikz.add_node(0, 1, 'D')\n",
51+
"tikz.add_node(0.5, 0.5, content='Cube', layer=2)\n",
4952
"\n",
5053
"# Add a line between nodes \n",
51-
"tikz.add_path([node_a, 'B', 'C', 'A', last_node], color='green', style='solid', line_width='2pt')\n",
54+
"tikz.add_path(['A', 'B', 'C', 'D'], path_actions=['draw', 'rounded corners'], fill='red', opacity=0.5,cycle=True)\n",
5255
"\n",
5356
"# Generate the TikZ script\n",
5457
"script = tikz.generate_tikz()\n",
@@ -60,7 +63,7 @@
6063
},
6164
{
6265
"cell_type": "code",
63-
"execution_count": 28,
66+
"execution_count": 5,
6467
"id": "344589d9-c60f-4d01-8171-e35db585f1ad",
6568
"metadata": {},
6669
"outputs": [
@@ -96,7 +99,7 @@
9699
" dtype=object))"
97100
]
98101
},
99-
"execution_count": 28,
102+
"execution_count": 5,
100103
"metadata": {},
101104
"output_type": "execute_result"
102105
}

tutorials/tutorial_1.ipynb

Lines changed: 38 additions & 44 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)