Skip to content

Commit 72da294

Browse files
committed
chore: minor changes in plot colors and readme text
1 parent b81738a commit 72da294

6 files changed

Lines changed: 213 additions & 124 deletions

File tree

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
[![PyPI](https://img.shields.io/pypi/v/compute-geometry)](https://pypi.org/project/compute-geometry/)
2-
[![GitHub](https://img.shields.io/github/license/kleyt0n/compute-geometry)](https://github.com/kleyt0n/compute-geometry/blob/master/LICENSE)
1+
<p align="center">
2+
<img src="public/logo.svg" alt="compute-geometry" width="116" height="116">
3+
</p>
34

5+
<h1 align="center">compute-geometry</h1>
46

5-
**compute-geometry** is a research-focused computational geometry library for Python. This library is designed to provide a set of tools and algorithms for solving geometric problems.
7+
<p align="center">
8+
A research-focused computational geometry library for Python.
9+
</p>
610

7-
[ROADMAP](ROADMAP.md)
11+
<p align="center">
12+
<a href="https://pypi.org/project/compute-geometry/"><img src="https://img.shields.io/pypi/v/compute-geometry" alt="PyPI"></a>
13+
<a href="https://github.com/kleyt0n/compute-geometry/blob/master/LICENSE"><img src="https://img.shields.io/github/license/kleyt0n/compute-geometry" alt="License"></a>
14+
</p>
15+
16+
**compute-geometry** is a research-focused computational geometry library for Python, providing a set of composable primitives and algorithms for solving geometric problems.
817

918
## Installation
1019

cgeom/visualization/_plotting.py

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@
2121
})
2222

2323
# ---------------------------------------------------------------------------
24-
# Grayscale palette — hand-picked hex grays
24+
# Blue / navy palette — deep navies for structure, Smart Blue for focal data,
25+
# slate & lavender greys for labels and annotations.
2526
# ---------------------------------------------------------------------------
26-
_INK = "#1a1a1a" # near-black — primary data (points, main edges)
27-
_CHARCOAL = "#4a4a4a" # dark gray — secondary edges, lines
28-
_STEEL = "#7a7a7a" # medium gray — tertiary, tick labels, axis labels
29-
_SILVER = "#a8a8a8" # light-medium — annotations, dashes, subtle markers
30-
_ASH = "#d4d4d4" # light gray — spines, ticks (if ever needed)
31-
_MIST = "#ededed" # very faint — fill base color
32-
_BG = "#fafafa" # off-white — figure & axes background
27+
_INK = "#002855" # Prussian Blue — primary structure, main edges
28+
_ACCENT = "#0466c8" # Smart Blue — focal data points, emphasis
29+
_CHARCOAL = "#023e7d" # Regal Navy — secondary edges, lines
30+
_STEEL = "#5c677d" # Blue Slate — tick labels, axis labels
31+
_SILVER = "#7d8597" # Slate Grey — annotations, dashes, subtle markers
32+
_ASH = "#979dac" # Lavender Grey — light ticks, borders
33+
_MIST = "#e6e9f1" # faint lavender — grid lines, fill base color
34+
_BG = "#fbfcfe" # cool near-white — figure & axes background
3335

3436
# ---------------------------------------------------------------------------
3537
# Visual sizing constants
@@ -53,15 +55,16 @@ def _hex_to_rgb(hex_color):
5355

5456

5557
def _style_ax(ax, title=None):
56-
"""Apply a minimal look to an axes object."""
58+
"""Apply a minimal, modern look to an axes object."""
5759
if title:
58-
ax.set_title(title, fontsize=12, fontweight="300",
59-
color=_INK, pad=14)
60+
ax.set_title(title, loc="left", fontsize=12.5, fontweight="500",
61+
color=_INK, pad=12)
6062
ax.set_facecolor(_BG)
61-
ax.grid(False)
63+
ax.set_axisbelow(True)
64+
ax.grid(True, color=_MIST, linewidth=0.7, zorder=0)
6265
for spine in ax.spines.values():
6366
spine.set_visible(False)
64-
ax.tick_params(colors=_STEEL, labelsize=7.5, length=0, width=0)
67+
ax.tick_params(colors=_STEEL, labelsize=7.5, length=0, width=0, pad=4)
6568

6669

6770
def _new_fig(figsize=(5.5, 5.5)):
@@ -101,7 +104,7 @@ def plot_convex_hull(hull_obj, title="Convex Hull"):
101104
)
102105
ax.scatter(
103106
[p[0] for p in ch], [p[1] for p in ch],
104-
c=_INK, s=_PT_ACCENT, zorder=4,
107+
c=_ACCENT, s=_PT_ACCENT, zorder=4,
105108
edgecolors="white", linewidths=_PT_EDGE_W,
106109
)
107110

@@ -152,7 +155,7 @@ def plot_min_circle_random(mc_obj, sizes, path=None, show=False):
152155
ax = axes[idx]
153156
_style_ax(ax, label)
154157
ax.set_aspect("equal")
155-
ax.scatter(x, y, c=_INK, s=16, zorder=3,
158+
ax.scatter(x, y, c=_ACCENT, s=16, zorder=3,
156159
edgecolors="white", linewidths=_PT_EDGE_W)
157160
circle_patch = plt.Circle(
158161
circ[0], circ[1],
@@ -175,7 +178,7 @@ def plot_min_circle_random(mc_obj, sizes, path=None, show=False):
175178
# Runtime comparison
176179
fig, ax = _new_fig(figsize=(5.5, 4))
177180
_style_ax(ax, "Runtime")
178-
ax.plot(sizes, time_min_circle, color=_INK, linewidth=_LINE_W,
181+
ax.plot(sizes, time_min_circle, color=_ACCENT, linewidth=_LINE_W,
179182
marker="o", markersize=4, label="Exact")
180183
ax.plot(sizes, time_heuristic, color=_SILVER, linewidth=_LINE_W,
181184
marker="o", markersize=4, label="Heuristic")
@@ -223,7 +226,7 @@ def plot_min_circle(mc_obj, data, path=None, show=False):
223226
ax = axes[idx]
224227
_style_ax(ax, label)
225228
ax.set_aspect("equal")
226-
ax.scatter(data[:, 0], data[:, 1], c=_INK, s=16,
229+
ax.scatter(data[:, 0], data[:, 1], c=_ACCENT, s=16,
227230
zorder=3, edgecolors="white", linewidths=_PT_EDGE_W)
228231
circle_patch = plt.Circle(
229232
circ[0], circ[1],
@@ -247,7 +250,7 @@ def plot_min_circle(mc_obj, data, path=None, show=False):
247250
fig, ax = _new_fig(figsize=(4, 3.5))
248251
_style_ax(ax, "Runtime")
249252
ax.bar(["Exact", "Heuristic"], [t_exact, t_heur],
250-
color=[_CHARCOAL, _SILVER], width=0.40,
253+
color=[_ACCENT, _SILVER], width=0.40,
251254
edgecolor=_BG, linewidth=0.6)
252255
ax.set_ylabel("Time (s)", fontsize=8.5, color=_STEEL)
253256
ax.yaxis.set_major_formatter(ticker.FormatStrFormatter("%.4f"))
@@ -284,7 +287,7 @@ def plot_triangulation(tri_obj):
284287
linestyle=(0, (3, 4)), zorder=3)
285288

286289
ax.scatter(tri_obj.poly[:, 0], tri_obj.poly[:, 1],
287-
c=_INK, s=_PT_SIZE, zorder=4,
290+
c=_ACCENT, s=_PT_SIZE, zorder=4,
288291
edgecolors="white", linewidths=_PT_EDGE_W)
289292

290293
plt.tight_layout()
@@ -338,7 +341,7 @@ def plot_delaunay(dt_obj, title="Delaunay Triangulation", show_circumcircles=Fal
338341
# Points on top
339342
ax.scatter(
340343
dt_obj.points[:, 0], dt_obj.points[:, 1],
341-
c=_INK, s=_PT_SIZE, zorder=4,
344+
c=_ACCENT, s=_PT_SIZE, zorder=4,
342345
edgecolors="white", linewidths=_PT_EDGE_W,
343346
)
344347

@@ -383,7 +386,7 @@ def plot_intersections(si_obj, title="Segment Intersections"):
383386
ix = [p[0] for p in intersections]
384387
iy = [p[1] for p in intersections]
385388
ax.scatter(
386-
ix, iy, c=_INK, s=50, zorder=5,
389+
ix, iy, c=_ACCENT, s=50, zorder=5,
387390
marker="o", edgecolors="white", linewidths=1.2,
388391
)
389392

@@ -414,7 +417,7 @@ def plot_voronoi(voronoi_obj, cells):
414417
color=(*_hex_to_rgb(_CHARCOAL), 0.45),
415418
solid_capstyle="round", zorder=2)
416419

417-
ax.scatter(data[:, 0], data[:, 1], c=_INK, s=_PT_SIZE, zorder=4,
420+
ax.scatter(data[:, 0], data[:, 1], c=_ACCENT, s=_PT_SIZE, zorder=4,
418421
edgecolors="white", linewidths=_PT_EDGE_W)
419422

420423
pad_x = (data[:, 0].max() - data[:, 0].min()) * 0.12

0 commit comments

Comments
 (0)