Skip to content

Commit 073682f

Browse files
committed
square logos
1 parent c2a9655 commit 073682f

File tree

7 files changed

+4334
-990
lines changed

7 files changed

+4334
-990
lines changed

ci/logo.py

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,104 @@
9494
transparent = True,
9595
bbox_inches = "tight",
9696
)
97+
98+
fig.savefig(
99+
"UltraPlotLogo.png",
100+
transparent = True,
101+
bbox_inches = "tight",
102+
)
103+
fig.show()
104+
105+
106+
# %%
107+
import ultraplot as plt, numpy as np
108+
109+
from matplotlib.font_manager import FontProperties
110+
from matplotlib import patheffects as pe
111+
from matplotlib.patches import Rectangle
112+
from scipy.ndimage import gaussian_filter
113+
114+
font = FontProperties(fname='./PermanentMarker-Regular.ttf')
115+
116+
117+
fs = 38
118+
left = 0.5
119+
sw = 3
120+
fig, ax = plt.subplots(figsize = (2, 2))
121+
ax.text(left, 0.52, "Ultra",
122+
fontsize = fs,
123+
fontproperties = font,
124+
va = "bottom",
125+
ha = "center",
126+
color = "steelblue",
127+
path_effects = [
128+
pe.Stroke(linewidth = sw, foreground = "white"),
129+
pe.Normal(),
130+
],
131+
transform = ax.transAxes)
132+
ax.text(left, 0.48, "Plot",
133+
fontsize = fs,
134+
# fontproperties = font,
135+
va = "top",
136+
ha = "center",
137+
color = "white",
138+
path_effects = [
139+
pe.Stroke(linewidth = sw, foreground = "steelblue"),
140+
pe.Normal(),
141+
],
142+
transform = ax.transAxes)
143+
144+
shift = 0.033
145+
import colorengine as ce
146+
147+
colors = np.linspace(0, 1, 4, 0)
148+
# colors = plt.colormaps.get_cmap("viko")(colors)
149+
ax.axis(False)
150+
ax.axis("square")
151+
# fig.set_facecolor("lightgray")
152+
153+
154+
# Create checkerboard pattern
155+
n_squares_x, n_squares_y = 20, 8 # Adjust number of squares
156+
square_size = 0.1 # Size of each square
157+
158+
159+
fig_aspect = fig.get_figwidth() / fig.get_figheight()
160+
square_size_y = 0.1 # Base square size in y direction
161+
square_size_x = square_size_y / fig_aspect # Adjust x size to maintain square shape
162+
163+
n_squares_x = int(1.0 / square_size_x) + 1 # Calculate number of squares needed in x direction
164+
165+
# Create alpha mask with Gaussian fade
166+
x = np.linspace(-2, 2, n_squares_x
167+
)
168+
y = np.linspace(-2, 2, n_squares_y)
169+
X, Y = np.meshgrid(x, y)
170+
R = np.sqrt(X**2 + Y**2)
171+
alpha = np.exp(-R**2/0.75) # Adjust the 1.0 to control fade rate
172+
alpha = gaussian_filter(alpha, sigma=0.5) # Adjust sigma for smoothness
173+
174+
# Create colormap gradient
175+
cmap = plt.colormaps.get_cmap("viko") # Choose your colormap
176+
177+
for i in range(n_squares_x):
178+
for j in range(n_squares_y):
179+
if (i + j) % 2 == 0: # Checkerboard pattern
180+
color = cmap(i/n_squares_x) # Color varies along x-axis
181+
rect = Rectangle(
182+
(i*square_size_x, j*square_size_y + 0.075),
183+
square_size_x, square_size_y,
184+
facecolor=color,
185+
alpha=alpha[j, i],
186+
transform=ax.transAxes
187+
)
188+
ax.add_patch(rect)
189+
190+
191+
192+
fig.savefig(
193+
"UltraPlotLogoSquare.png",
194+
transparent = True,
195+
bbox_inches = "tight",
196+
)
97197
fig.show()

0 commit comments

Comments
 (0)