diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 99168510..360acc2a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.9 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -34,7 +34,7 @@ repos: types_or: [python, pyi, jupyter] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.1 + rev: v1.15.0 hooks: - id: mypy files: ^src @@ -42,7 +42,7 @@ repos: additional_dependencies: ["numpy~=2.2.0", "matplotlib>=3.4", "boost-histogram~=1.5.0", "uhi~=0.3.1", "pandas-stubs>=2.0.1.230501"] - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell args: ["-Lhist,gaus,nd"] diff --git a/docs/user-guide/notebooks/SVGHistogram.ipynb b/docs/user-guide/notebooks/SVGHistogram.ipynb index 8f46159a..94455736 100644 --- a/docs/user-guide/notebooks/SVGHistogram.ipynb +++ b/docs/user-guide/notebooks/SVGHistogram.ipynb @@ -448,22 +448,22 @@ "\n", " polylines = [\n", " polyline(\n", - " points=f\"{3*20}, {3*20+105} \"\n", - " f\"{3*20+30}, {3*20+105} \"\n", - " f\"{3*20+30}, {3*20+95} \"\n", - " f\"{3*20+40}, {3*20+95} \"\n", - " f\"{3*20+40}, {3*20+70} \"\n", - " f\"{3*20+50}, {3*20+70} \"\n", - " f\"{3*20+50}, {3*20+52} \"\n", - " f\"{3*20+60}, {3*20+52} \"\n", - " f\"{3*20+60}, {3*20+45} \"\n", - " f\"{3*20+70}, {3*20+45} \"\n", - " f\"{3*20+70}, {3*20+65} \"\n", - " f\"{3*20+80}, {3*20+65} \"\n", - " f\"{3*20+80}, {3*20+95} \"\n", - " f\"{3*20+90}, {3*20+95} \"\n", - " f\"{3*20+90}, {3*20+105} \"\n", - " f\"{3*20+120}, {3*20+105} \",\n", + " points=f\"{3 * 20}, {3 * 20 + 105} \"\n", + " f\"{3 * 20 + 30}, {3 * 20 + 105} \"\n", + " f\"{3 * 20 + 30}, {3 * 20 + 95} \"\n", + " f\"{3 * 20 + 40}, {3 * 20 + 95} \"\n", + " f\"{3 * 20 + 40}, {3 * 20 + 70} \"\n", + " f\"{3 * 20 + 50}, {3 * 20 + 70} \"\n", + " f\"{3 * 20 + 50}, {3 * 20 + 52} \"\n", + " f\"{3 * 20 + 60}, {3 * 20 + 52} \"\n", + " f\"{3 * 20 + 60}, {3 * 20 + 45} \"\n", + " f\"{3 * 20 + 70}, {3 * 20 + 45} \"\n", + " f\"{3 * 20 + 70}, {3 * 20 + 65} \"\n", + " f\"{3 * 20 + 80}, {3 * 20 + 65} \"\n", + " f\"{3 * 20 + 80}, {3 * 20 + 95} \"\n", + " f\"{3 * 20 + 90}, {3 * 20 + 95} \"\n", + " f\"{3 * 20 + 90}, {3 * 20 + 105} \"\n", + " f\"{3 * 20 + 120}, {3 * 20 + 105} \",\n", " style=\"fill:none;stroke:black;stroke-width:2\",\n", " ),\n", " ]\n", @@ -538,8 +538,8 @@ " polygons.append(\n", " polygon(\n", " points=\"150, 125 \"\n", - " f\"{150+100*norm_vals[i] * math.cos(i * ang)}, {125+100*norm_vals[i] * math.sin(i * ang)} \"\n", - " f\"{150+100*norm_vals[i] * math.cos((i+1) * ang)}, {125+100*norm_vals[i] * math.sin((i+1) * ang)} \",\n", + " f\"{150 + 100 * norm_vals[i] * math.cos(i * ang)}, {125 + 100 * norm_vals[i] * math.sin(i * ang)} \"\n", + " f\"{150 + 100 * norm_vals[i] * math.cos((i + 1) * ang)}, {125 + 100 * norm_vals[i] * math.sin((i + 1) * ang)} \",\n", " style=\"fill:none;stroke:black;stroke-width:2\",\n", " )\n", " )\n", @@ -548,7 +548,7 @@ " circle(\n", " cx=\"150\",\n", " cy=\"125\",\n", - " r=f\"{30*min(norm_vals)}\",\n", + " r=f\"{30 * min(norm_vals)}\",\n", " stroke=\"black\",\n", " fill=\"white\",\n", " stroke_width=\"3\",\n", diff --git a/src/hist/svgplots.py b/src/hist/svgplots.py index a9379d56..981a35ff 100644 --- a/src/hist/svgplots.py +++ b/src/hist/svgplots.py @@ -105,7 +105,7 @@ def svg_hist_1d(h: hist.BaseHist) -> svg: upper, label, bins, - viewBox=f"-10 {-height-5} {width+20} {height+20}", + viewBox=f"-10 {-height - 5} {width + 20} {height + 20}", ) @@ -142,7 +142,7 @@ def svg_hist_1d_c(h: hist.BaseHist) -> svg: style="fill:none;stroke-width:2;stroke:currentColor", ) - return svg(bins, center, viewBox=f"{-width/2} {-height/2} {width} {height}") + return svg(bins, center, viewBox=f"{-width / 2} {-height / 2} {width} {height}") def svg_hist_2d(h: hist.BaseHist) -> svg: @@ -190,8 +190,10 @@ def svg_hist_2d(h: hist.BaseHist) -> svg: h.axes[1], x=-10, y=-height / 2, - transform=f"rotate(-90,{-10},{-height/2})", + transform=f"rotate(-90,{-10},{-height / 2})", ), ] - return svg(*texts, *boxes, viewBox=f"{-20} {-height - 20} {width+40} {height+40}") + return svg( + *texts, *boxes, viewBox=f"{-20} {-height - 20} {width + 40} {height + 40}" + )