feat: markers + adjusted density

This commit is contained in:
julius 2024-08-14 12:55:22 +02:00
parent 5941ed7909
commit eaa2541596
No known key found for this signature in database
GPG Key ID: C80A63E6A5FD7092

View File

@ -74,7 +74,7 @@ def make_wallpaper(
fileformat: str = "svg", fileformat: str = "svg",
orientation: str | None = "landscape", orientation: str | None = "landscape",
local: bool = False, local: bool = False,
marker: str | None = ".", markers: str | None = ".",
): ):
if fileformat not in MEDIA_TYPES: if fileformat not in MEDIA_TYPES:
return return
@ -96,7 +96,7 @@ def make_wallpaper(
return return
else: else:
x, y = (1920, 1080) x, y = (1920, 1080)
speckles_per_colour = int(x / 128 * y / 128 * density) speckles_per_colour = int(x / 128 * y / 128 * density / len(markers))
fig, ax = plt.subplots(figsize=(x / 120, y / 120), facecolor=background) fig, ax = plt.subplots(figsize=(x / 120, y / 120), facecolor=background)
ax.set_facecolor(background) ax.set_facecolor(background)
@ -105,8 +105,9 @@ def make_wallpaper(
ax.set_yticks([]) ax.set_yticks([])
ax.margins(0, 0) ax.margins(0, 0)
for color, size in itertools.product( for color, marker, size in itertools.product(
speckle_colours, speckle_colours,
markers,
np.logspace(0, size, 10, base=np.exp(2)), np.logspace(0, size, 10, base=np.exp(2)),
): ):
ax.scatter( ax.scatter(
@ -114,7 +115,7 @@ def make_wallpaper(
[random.random() * y / 8 for _ in range(speckles_per_colour)], [random.random() * y / 8 for _ in range(speckles_per_colour)],
c=color, c=color,
s=size, s=size,
marker=random.choice(marker), marker=marker,
) )
fig.tight_layout() fig.tight_layout()