With all the playing about over the last while, I decided to take a look at reducing the data used to generate the gnarly style plots. I thought I’d look at a few different reductions/orderings. Including a random version.
New Plot Types
To make my life easier I decided to just create a few new plot types. Each of which selects a different subset of rows from the complete wheel datasets. But I did put them all in a single if
block.
elif do_plt in [22, 23, 24, 25]:
# 'gnarly' curve, a random shape for each wheel
# experiment with using subset of wheel data rather than all of it
# 22: plot subset (n, n-2, n-4, ...)
# 23: plot subset (n, n-1, n-3, ...)
# 24: plot subset ([x=0,1,2], x+3, x+6, ...), if enough wheels
# 25: plot random sized subset, in random order
if t_su:
print(f"{do_plt}: {t_su}")
if t_tl:
# this needs fixing, t_su or su as one is null, but I seldom print title, so...
m_ttl = get_plt_ttl(shp=t_su, ld=r_skp, df=drp_f, lw=ln_w)
fig.suptitle(m_ttl)
# set up data for plot
p_xs = []
p_ys = []
strt = n_whl-1
if not (t_sv or sv_plot):
if do_plt == 22:
rws = list(range(strt, -1, -2))
elif do_plt == 23:
rws = list(range(strt-1, -1, -2))
elif do_plt == 24:
if n_whl == 3:
rws = np.random.choice([0, 1, 2], size=2, replace=False)
elif n_whl <= 5:
# rws = list(range(2, n_whl, +3))
s_tmp = list(range(0, n_whl))
rws = np.random.choice(s_tmp, size=3, replace=False)
else:
s_tmp = n_whl % 3
rws = list(range(strt-s_tmp, -1, -3))
rws.sort()
elif do_plt == 25:
if n_whl == 3:
n_kp = 2
else:
n_kp = np.random.randint(2, n_whl)
r_nx = list(range(0, n_whl))
rws = np.random.choice(r_nx, size=n_kp, replace=False)
if strt >= len(r_xs):
r_xs, r_ys, m_xs, m_ys, m2_xs, m2_ys = get_gnarly_dset(t_xs, t_ys, 0, drp_f, t_sy)
for rw in rws:
p_xs.append(r_xs[rw])
p_ys.append(r_ys[rw])
if p_xs:
print(f"{do_plt}: rows: {rws}, n_whl: {n_whl}, len r_xs: {len(r_xs)}, len p_xs: {len(p_xs)}")
ax.plot(p_xs, p_ys, lw=ln_w, alpha=alph)
ax.plot(m_xs, m_ys, lw=ln_w, alpha=alph)
ax.plot(m2_xs, m2_ys, lw=ln_w, alpha=alph)
set_plot_lim(ax)
bax, abg = set_bg(ax, xy_adj=b_adj)
Examples
- This first example will show the image from my earlier basic gnarly plot type. Then the variations in the above code.
That is a ‘gnarly’ image using a random or user selected shape for all wheels. Wheels: 11 (Circle). 1024 plotting points.
Given we are using the same data for all these images, there is going to be a lot of similarity. Hopefully there will be some meaningful and noticeable differences.
And, yes they all look very similar. But there are difference, subtle though they may be, between all of them. Sadly, not as much difference as I was hoping for.
- This time I am starting with the ‘gnarly’ image using a randomly selected shape for each wheel. Wheels: 12 (’s’, ’s’, ’e’, ’e’, ’s’, ’t’, ‘r’, ‘r’, ’e’, ‘c’, ‘c’, ‘c’). Again 1024 plotting points for each image. And, since the rows dropped for gnarly images is randomly selected, this time for the base plot the first 3 rows of data were not plotted.
Again, similar but different. What I noticed most was how the shape in the center of the image kept changing.
Done
Just a variation I thought worth looking at. And, of course, sharing with you. A post short and sweet.
Hope you have enjoyed this series as much as I have. But unless some new variation comes to mind soon, this is likely the last post on spirographs.
Keeping coding and having fun doing so.