Setup¶

In [1]:
import math
from math import sqrt as mS
import matplotlib
from matplotlib.animation import FuncAnimation as FA
from matplotlib.patches import Circle as mpC
from matplotlib.patches import Rectangle as mpR
import matplotlib.pyplot as plt
import numpy as np

Constants & Functions¶

In [2]:
#Viridis.
colors = ["#FDE725FF",
          "#7AD151FF",
          "#22A884FF",
          "#2A788EFF",
          "#414487FF",
          "#440154FF"]

#Clear axes.
def clearAx(ax):
    
    """
    Clear axes.

    Parameters:
    ax - Current ax.
    
    Returns:
    ax - Updated ax.
    """    
    
    ax.spines["top"].set_visible(False)
    ax.spines["right"].set_visible(False)
    ax.spines["bottom"].set_visible(False)
    ax.spines["left"].set_visible(False)
    ax.set_xticks([])
    ax.set_yticks([])
    return(ax)





#Create a square
def createSquare(ax, x, y, s, c, a, z) :
    
    """
    Draws square.  First draws a white square to block out under layers
    to prevent discoloration with non 100 alpha levels.

    Parameters:
    ax - Current ax.
    x, y - Coordinates of bottom left vertex.
    s - Side length.
    c - Color.
    a - Angle of rotation.
    z - Zorder.
    
    Returns:
    ax - Updated ax with square.
    """
    
    ax.add_patch(mpR((x, y),
                     height = s,
                     width = s,
                     edgecolor = 'w',
                     facecolor = 'w',
                     angle = a,
                     rotation_point = 'center',
                     lw = 0,
                     zorder = z))
    
    ax.add_patch(mpR((x, y),
                     height = s,
                     width = s,
                     edgecolor = 'None',
                     facecolor = c,
                     angle = a,
                     rotation_point = 'center',
                     lw = 0,
                     zorder = z))
    return(ax)





#Create a square
def createCircle(ax, x, y, a) :

    """
    Draws circle and inscribed square.  First draws a white circle to
    block out under layers to prevent discoloration with non 100 alpha
    levels.

    Parameters:
    ax - Current ax.
    x, y - Coordinates of center.
    a - Angle of rotation for inscribed square.
    
    Returns:
    ax - Updated ax with square.
    """
    
    ax.add_patch(mpC((x, y),
                     radius = mS(2)/2,
                     edgecolor = 'w',
                     facecolor = 'w',
                     lw = 0,
                     zorder = 3))

    ax.add_patch(mpC((x, y),
                     radius = mS(2)/2,
                     edgecolor = 'None',
                     facecolor = colors[3][0:7]+"55",
                     lw = 0,
                     zorder = 3))
    
    ax = createSquare(ax, x-1/2, y-1/2, 1, colors[3], a, 4)

    return(ax)

Fiddler¶

In [3]:
def plotHelper(s, o) :
    
    n = 6
    
    if o != 'Fiddler' :
        n = 7
    
    fig = plt.figure(figsize = (8, 8))  
    ax = fig.add_subplot(xlim = (-n/4, n/4),
                         ylim = (-n/4, n/4))
    fig.subplots_adjust(left = 0.02, bottom = 0.02, right = 0.98, top = 0.98)

     
    #Remove axes and ticks.
    ax = clearAx(ax)

    #Full square board.
    ax = createSquare(ax, -s/2, -s/2, s, colors[5][0:7]+"55", 0, 1)
    #Right bottom corner square.
    ax = createSquare(ax, s/2-1, -s/2, 1, colors[1], 0, 2)
    
    
    if o == 'Fiddler' :
        #Other three corner squares.
        ax = createSquare(ax, -s/2, -s/2, 1, colors[1], 0, 2)
        ax = createSquare(ax, -s/2, s/2-1, 1, colors[1], 0, 2)
        ax = createSquare(ax, s/2-1, s/2-1, 1, colors[1], 0, 2)
        #Center circle.
        ax = createCircle(ax, 0, 0, 0)
    
    
    else :
        #Left bottom and top corner squares.
        ax = createSquare(ax, -s/2, -s/2, 1, colors[1][0:7]+"55", 0, 2)
        ax = createSquare(ax, -s/2, s/2-1, 1, colors[1][0:7]+"55", 0, 2)
        
        if o == 'ECcheck' :
            #Right top corner square.    
            ax = createSquare(ax, s/2-1, s/2-1, 1, colors[1][0:7]+"55", 0, 2)
            #Your three circle/squares.
            ax = createCircle(ax, mS(6)/3 + 0.2, 0.2, 45)
            ax = createCircle(ax, -mS(6)/6 - 0.2, mS(2)/2 + 0.2, 39)
            ax = createCircle(ax, -mS(6)/6 - 0.2, -mS(2)/2 - 0.2, 7)
        
        else :
            #Right top corner square.
            ax = createSquare(ax, s/2-1, s/2-1, 1, colors[1], 0, 2)
            #Your three circle/squares.
            ax = createCircle(ax, mS(6)/3, 0, 45)
            ax = createCircle(ax, -mS(6)/6, mS(2)/2, 39)
            ax = createCircle(ax, -mS(6)/6, -mS(2)/2, 7)
            #Center circle.
            ax.add_patch(mpC((0,0),
                             radius = mS(6)/3+mS(2)/2,
                             edgecolor = colors[3],
                             facecolor = 'None',
                             ls = ':',
                             lw = 2,
                             zorder = 3))

    fig.savefig('2025.08.01' + o + '.png', bbox_inches = "tight");
In [4]:
plotHelper(3, 'Fiddler')
In [5]:
plotHelper(2+mS(2), 'ECcheck')
In [6]:
plotHelper(2+mS(2), 'ECfinal')
Rohan Lewis¶

2025.08.04¶