Skip to content

Commit 2b1342e

Browse files
committed
Formatting
1 parent c99393e commit 2b1342e

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

src/maxplotlib/canvas/canvas.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,16 @@ def plot_tikzfigure(
851851
ax = fig.subfigure_axis(
852852
xlabel=line_plot._xlabel or "",
853853
ylabel=line_plot._ylabel or "",
854-
xlim=(line_plot._xmin, line_plot._xmax) if line_plot._xmin is not None else None,
855-
ylim=(line_plot._ymin, line_plot._ymax) if line_plot._ymin is not None else None,
854+
xlim=(
855+
(line_plot._xmin, line_plot._xmax)
856+
if line_plot._xmin is not None
857+
else None
858+
),
859+
ylim=(
860+
(line_plot._ymin, line_plot._ymax)
861+
if line_plot._ymin is not None
862+
else None
863+
),
856864
grid=line_plot._grid,
857865
caption=line_plot._title or f"Subplot {col+1}",
858866
width=0.45,

src/maxplotlib/tests/test_canvas.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ def test():
55
def test_canvas_plot_tikzfigure_horizontal_subplots():
66
"""Test that Canvas.plot_tikzfigure() works with horizontal (1×n) layouts."""
77
import numpy as np
8+
89
from maxplotlib import Canvas
910

1011
# Create a 1×2 canvas
@@ -33,6 +34,7 @@ def test_canvas_plot_tikzfigure_horizontal_subplots():
3334
def test_canvas_plot_tikzfigure_three_subplots():
3435
"""Test 1×3 layout with tikzfigure backend."""
3536
import numpy as np
37+
3638
from maxplotlib import Canvas
3739

3840
x = np.linspace(0, 2 * np.pi, 50)
@@ -57,9 +59,10 @@ def test_canvas_plot_tikzfigure_three_subplots():
5759
def test_canvas_plot_tikzfigure_vertical_not_supported():
5860
"""Test that vertical layouts raise NotImplementedError."""
5961
import numpy as np
60-
from maxplotlib import Canvas
6162
import pytest
6263

64+
from maxplotlib import Canvas
65+
6366
x = np.linspace(0, 2 * np.pi, 50)
6467
# Create 2×1 layout (nrows=2)
6568
canvas, axes = Canvas.subplots(nrows=2, width="10cm")

tutorials/tutorial_02.ipynb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"metadata": {},
4343
"outputs": [],
4444
"source": [
45-
"\n",
4645
"fig = TikzFigure()\n",
4746
"\n",
4847
"x = np.linspace(0, 360, 200)\n",
@@ -51,22 +50,26 @@
5150
"\n",
5251
"# First subfigure: sine wave\n",
5352
"ax1 = fig.subfigure_axis(\n",
54-
" xlabel=\"x\", ylabel=\"y\",\n",
55-
" xlim=(0, 360), ylim=(-1.5, 1.5),\n",
53+
" xlabel=\"x\",\n",
54+
" ylabel=\"y\",\n",
55+
" xlim=(0, 360),\n",
56+
" ylim=(-1.5, 1.5),\n",
5657
" grid=True,\n",
5758
" caption=\"Sine Function\",\n",
58-
" width=0.45\n",
59+
" width=0.45,\n",
5960
")\n",
6061
"ax1.add_plot(x=x, y=y1, label=\"sin(x)\", color=\"red\", line_width=\"1.5pt\")\n",
6162
"ax1.set_legend(position=\"north east\")\n",
6263
"\n",
6364
"# Second subfigure: cosine wave\n",
6465
"ax2 = fig.subfigure_axis(\n",
65-
" xlabel=\"x\", ylabel=\"y\",\n",
66-
" xlim=(0, 360), ylim=(-1.5, 1.5),\n",
66+
" xlabel=\"x\",\n",
67+
" ylabel=\"y\",\n",
68+
" xlim=(0, 360),\n",
69+
" ylim=(-1.5, 1.5),\n",
6770
" grid=True,\n",
6871
" caption=\"Cosine Function\",\n",
69-
" width=0.45\n",
72+
" width=0.45,\n",
7073
")\n",
7174
"ax2.add_plot(x=x, y=y2, label=\"cos(x)\", color=\"blue\", line_width=\"1.5pt\")\n",
7275
"ax2.set_legend(position=\"north east\")\n",
@@ -89,7 +92,6 @@
8992
"metadata": {},
9093
"outputs": [],
9194
"source": [
92-
"\n",
9395
"canvas, (ax1, ax2) = Canvas.subplots(ncols=2, width=1000, ratio=0.3)\n",
9496
"\n",
9597
"x = np.linspace(0, 2 * np.pi, 200)\n",

tutorials/tutorial_tikzfigure_subplots.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"source": [
2424
"from maxplotlib import Canvas\n",
2525
"import numpy as np\n",
26+
"\n",
2627
"%load_ext autoreload\n",
2728
"%autoreload 2"
2829
]

0 commit comments

Comments
 (0)