I am trying to draw a Brownian motion on top of the following canvas:
import matplotlib
import matplotlib.pyplot as plt
palette = matplotlib.colors.ListedColormap(['#F08080'])
gridCells = np.ones((50, 50)) * np.nan
gridCells.shape
N=50
for j in range(10)[::-1]:
gridCells[N//4 - j : N//4 + j +1, N//4 - j - 25 : N//4 + j - 25 +1] = j
# Draw
fig, ax = plt.subplots(1, 1, tight_layout=True)
# NaN values (i.e. bad) stay white
palette.set_bad(color='w', alpha=0)
for x in range(N + 1):
ax.axhline(x, color='k', zorder=1)
ax.axvline(x, color='k', zorder=1)
ax.imshow(gridCells, interpolation='none', cmap=palette, extent=[0, N, 0, N], zorder=0)
ax.axis('off')
How may I now draw a brownian motion overlaying this canvas?
Thank you in advance for your help anyone!