While working on the do-it-all spirograph module, I decided to write a module that would generate a random curve, then create a multi-plot figure showing how that curve is rendered by some of the different plot types we tried out during this series of posts on spirographs. They are:

  • basic curve
  • cycling line width simulation using lines perpendicular to the x-axis for each point on the underlying curve
  • cycling line width simulation using lines perpendicular to the y-axis for each point on the underlying curve
  • my first attempt at cycling line width simulation using lines orthogonal to the underlying curve
  • my second, more mathematical, attempt at cycling line width simulation using lines orthogonal to the underlying curve
  • a gnarly version of the curve (still not sure what matplotlib is doing with what it is given)

After looking at the multi-plot figure, I figured it didn’t really show the differences in the various plots. So I added code to the module that would plot each of the variations in a separate figure. Each time a figure was closed the next one would be generated. Takes a few seconds to complete.

It is very much a test/play script, so don’t expect anything too lovely. Though the relevant code will be incorporated in the do–it-all module.

And my apologies — not really a proper post.

Before I give you the rather lengthy code, here’s a sample of one set of the 7 figures generated on each execution.

figure with subplots showing various versions of the same curve a larger image of the basic curve a larger image of the cycling line width simulation using lines perpendicular to the x-axis a larger image of the cycling line width simulation using lines perpendicular to the y-axis a larger image of the cycling line width simulation of my first attempt to use lines orthogonal to the underlying curve a larger image of the cycling line width simulation of my second attempt to use lines orthogonal to the underlying curve a larger image of the 'gnarly' version

Code?

After having posted a number of listings of my code, I have decided not to provide complete listings of my modules.

I reckon if you are interested in learning to code, you really should be using my posts to generate your own code and modules. Not just copying mine.

If you are only interested in copying my code to generate images, that is not why I wrote these posts.

So, sorry, but I am, as of 2022.07.22, going to remove the code listings from all the code listing posts.