There you go, I am still all caught up in the generation of spirograph images. Had been playing around with curves in 3D, when I decided to look at adding background colour(s) to the 2D images.

Took some fooling around (mainly because I was turning the axes off), but got a single colour background to work. Then I decided to go for a gradient. Then I figured I should try to make a splotchy background rather than something as symmetrical as a gradient. Made two versions of functions for that latter approach. In each case the background colours are pulled from the same colour map being used to generated the curve image.

Here’s some examples. Most of them use the gnarly plot style. Though there are a few using the cycling line width algorithm.

Do you like them better than the ones with a white background?

To be honest I kinda of like them all. But seems to me that the coloured backgrounds do add something a little extra to the images.

Note: this post was initially written 2022.04.26. I had only been playing with background colors for a few days. But made some decent progress.

Examples

Sorry about the extra white space around the images. Think I may have been messing around with the aspect ratio a little too much.

And, for most of these I used a fairly low number (500) of plotting points. So the lines in the plots tend to be separated. I did use higher numbers for some of the plots and you will likely be able to tell the difference.

Early Attempts

The following are some of my earliest attempts. Hopefully in chronological order. Primarily solid colour backgrounds.

image of plot generated using the spirograph script but with background colours
gn_3_2_1_dpi600_w12_magma_p500_04241659_rdw.png
image of plot generated using the spirograph script but with background colours
gn_4_4_1_dpi600_w8_PuBuGn_p500_04241718_rdw.png
image of plot generated using the spirograph script but with background colours
gn_4_2_1_dpi600_w6_twilight_shifted_p500_04241722_rdw.png
image of plot generated using the spirograph script but with background colours
gn_7_2_1_dpi600_w20_magma_p500_04241723_rdw.png
image of plot generated using the spirograph script but with background colours
gn_8_3_1_dpi600_w15_plasma_p500_04241730_rdw.png

The next one is actually a black background, but at 0.66 opacity (aka alpha value). An opacity of 1.0 would have been fully black. In fact the backgrounds in probably all of the images are displayed with a reduced opacity. Figured I didn’t want the background dominating the image.

image of plot generated using the spirograph script but with background colours
gn_4_2_1_dpi600_w1_PuRd_p500_04250646_rdw.png

Mid-term Development

The next group were a little later in my development effort. It’s where I worked on coding the gradient background.

Was having some problems getting the gradient to fill the plot area, so added back the axes to try help me figure out what was wrong with my approach/code.

image of plot generated using the spirograph script but with background colours
gn_5_2_1_dpi600_wNone_PuBuGn_p500_04251338_rdw.png

Next two are the same curve but one plot with a gradient background and the other with a single colour background.

image of plot generated using the spirograph script but with background colours
gn_3_3_1_dpi600_w19_hot_p500_04251626_rdw.png
image of plot generated using the spirograph script but with background colours
gn_3_3_1_dpi600_w19_hot_p500_04251626_rdw.png

The background colour was pulled from the bone colour map. It is a dark colour but is displayed at an opacity of .54.

image of plot generated using the spirograph script but with background colours
gn_7_3_1_dpi600_w4_bone_p500_04251627_rdw.png
image of plot generated using the spirograph script but with background colours
gn_7_2_1_dpi600_w10_PuBu_p500_04251631_rdw.png
image of plot generated using the spirograph script but with background colours
gn_5_2_1_dpi600_wNone_hot_p500_04251640_rdw.png

The next two are the same curve but the first has a solid colour background, the second a gradient background.

image of plot generated using the spirograph script but with background colours
clz_3_3_2_dpi600_w10_plasma_p500_04251648_rdw.png
image of plot generated using the spirograph script but with background colours
clz_3_3_2_dpi600_w10_plasma_p500_04251649_rdw.png

The following two surprised me, until I thought about the colour map. There are only 10 colours in the colour map, so each colour occupies a larger slice of the pie than in the other colour maps. Most of the other colourmaps have a larger range of graduated colours which allows for a more sutble gradient. The first is a gnarly style, the second a cycling line width style. I believe it is the same curve data for both plots. But hard to tell as the first drops the last row from the plot. I.E. the row actually used to plot the second.

But definitely an interesting result. Wonder if I can figure out a way to do something similar with the other colour maps.

image of plot generated using the spirograph script but with background colours
gn_3_2_1_dpi600_w14_default_p1000_04251737_rdw.png
image of plot generated using the spirograph script but with background colours
clz_3_2_1_dpi600_w13_default_p1000_04251738_rdw.png

An increased number of data points. Wanted a little more contrast against that strong background gradient. It used an alpha value of 0.72 for the background. And, it selected colour values in the middle 50% of the colour map.

image of plot generated using the spirograph script but with background colours
gn_7_6_3_dpi600_w13_hot_p1600_04251653_rdw.png

The following two are the same curve. The second using twice as many plotting points. They used different ranges from the colour map for the gradient, as well as different opacities. Kinda like the one with the lower number of plotting points.

image of plot generated using the spirograph script but with background colours
gn_5_2_1_dpi600_w6_PuBu_p500_04251731_rdw.png
image of plot generated using the spirograph script but with background colours
gn_5_2_1_dpi600_w6_PuBu_p1000_04251734_rdw.png

Both of the next two use a higher number of plotting points.

Solid colour background, but figured that would make the colours in the curve pop just a little bit more than if they were over a gradient.

image of plot generated using the spirograph script but with background colours
gn_7_6_4_dpi600_w13_jet_p1600_04251742_rdw.png

Did you notice that the gradient is running at an angle. The function randomly selects a direction from horizontal to vertical inclusive. The one in the following is roughly 45°. In fact most of the gradients are running at some angle. That first gradient in this group and the gradient for the firery cycling line width plot above are likely the only ones with the gradient running parallel to one of the axes.

image of plot generated using the spirograph script but with background colours
gn_6_5_3_dpi600_wNone_turbo_p1600_04251747_rdw.png

Recent Development

These are all from today when I started working on the splotchy backgrounds. They use one of two different approaches to generating the pattern. The first function I wrote in fact always generates the same pattern. The second is more or less random.

image of plot generated using the spirograph script but with background colours
gn_5_3_1_dpi600_wNone_magma_p2000_04260921_rdw.png

The next three are all the same curve, at fairly high number of data points. The only difference should be the backgrounds. Splotchy, gradient and solid colour in that order. Not sure why the aspect ratio changed?

image of plot generated using the spirograph script but with background colours
gn_5_2_1_dpi600_w14_plasma_p3000_04261036_rdw.png

Can you see the similarity in the two splotchy backgrounds.

image of plot generated using the spirograph script but with background colours
gn_5_2_1_dpi600_w14_plasma_p3000_04261039_rdw.png
image of plot generated using the spirograph script but with background colours
gn_5_2_1_dpi600_w14_plasma_p3000_04261042_rdw.png

A More Random Background

Here’s a few images using the second version, the more random colour assignment, of a splotchy background function.

image of plot generated using the spirograph script but with background colours
gn_6_4_3_dpi600_wNone_turbo_p2000_04261638_rdw.png

Another example of the crazy background when using the tab-10 colour map. And, an atypical image. Kinda of like the look.

image of plot generated using the spirograph script but with background colours
gn_3_3_1_dpi600_w3_default_p2000_04261640_rdw.png

I think one can clearly see that the arrangement of colours is more random than with the first splotchy function (see section above). And, with good reason.

image of plot generated using the spirograph script but with background colours
gn_3_3_1_dpi600_w3_twilight_shifted_p3000_04261956_rdw.png

Done

Well maybe. I have not yet tried using different colour maps for the plot and the background. Might prove difficult to coordinate for someone with my lack of visual skill.

I am also thinking about trying to generate that big, blob-like gradient using something other than Matplotlib’s tab-10 colour map.

And, I should likely write a post covering how the backgrounds are generated and some of the problems I had getting them to work. Problems not completely fixed — as the white space in the images above would attest.