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.
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.
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.
Next two are the same curve but one plot with a gradient background and the other with a single colour background.
The background colour was pulled from the bone colour map. It is a dark colour but is displayed at an opacity of .54.
The next two are the same curve but the first has a solid colour background, the second a gradient background.
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.
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.
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.
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.
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.
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.
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?
Can you see the similarity in the two splotchy backgrounds.
A More Random Background
Here’s a few images using the second version, the more random colour assignment, of a splotchy background function.
Another example of the crazy background when using the tab-10 colour map. And, an atypical image. Kinda of like the look.
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.
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.