add more marker symbols

This commit is contained in:
julius 2024-08-14 13:27:35 +00:00
parent cbaf9bc071
commit 06cf912490

21
main.py
View File

@ -65,6 +65,22 @@ Marker = Literal[
"_", "_",
] ]
marker_subs = {"=": "$=$", "/": "$/$",
"\\": "$\\setminus$",
"«": "$«$",
"»": "$»$",
"~": "$\\sim$",
"": "$♪$",
"": "$♫$",
"": "$\\infty$",
"": "$♡$",
"o": "$\\bigcirc$",
"": "$♠$",
"": "$♣$",
"": "$♥$",
"": "$♦$",
"🥑": "$🥑$"
}
@app.get("/speckles/") @app.get("/speckles/")
def make_wallpaper( def make_wallpaper(
@ -110,8 +126,7 @@ def make_wallpaper(
markers, markers,
np.logspace(0, size, 10, base=np.exp(2)), np.logspace(0, size, 10, base=np.exp(2)),
): ):
marker = marker.replace("=", "$=$") marker = marker_subs.get(marker, marker)
marker = marker.replace("~", "$\sim$")
ax.scatter( ax.scatter(
[random.random() * x / 8 for _ in range(speckles_per_colour)], [random.random() * x / 8 for _ in range(speckles_per_colour)],
[random.random() * y / 8 for _ in range(speckles_per_colour)], [random.random() * y / 8 for _ in range(speckles_per_colour)],
@ -145,4 +160,4 @@ def make_wallpaper(
if __name__ == "__main__": if __name__ == "__main__":
uvicorn.run("main:app", workers=2, port=8099, reload=False) uvicorn.run("main:app", workers=3, port=8099, reload=True)