Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.9 kB
2
Indexable
Never
import matplotlib.pyplot as pyplt
pyplt.rcParams["figure.figsize"] = (18, 1)

def plot_v2(xc, yc, alp, xShift, marker, clr, background_clr=""):
    if(yc%2 != 0):
        plt.plot((xc+xShift), yc, marker, color=clr, alpha=alp)
        if len(background_clr) > 0:
            ax = plt.axes()
            ax.set_facecolor(background_clr)
    else:
        plt.plot(xc, yc, marker, color=clr, alpha=alp)

def plotEyeTable_v2_test(table, c, u, r, d, l, y=8, markers='.', shift=0.5, alp=0.2, color='r', background_clr=""):
    xc = 0
    xShift = shift       #How much every second row is shifted to the right, 0.5 is how it is displayed in game.   
    
    #yc = len(table)       #to start plotting at the specified tables own height.
    yc = y          #to start plotting all tables at y = 12.
    
    # color = {'.c':0, '^g':1, '>b':2, 'vr':3, left_color:4 } #shapes matching eye direction   
    # clr = ['sk', '.c', '^g', '>b', 'red'] #here you can customize the colors and markers.
    
    # {0:'center', 1:'up', 2:'right', 3:'down', 4:'left'}
    for i in table:
        xc = 0
        for j in i:
            # alp = alphaReset
            if (c and j == 0):       #to change alpha on only one direction, remove 'not' and set alp to something between 0-1.
                plot_v2(xc, yc, alp, xShift, markers, color, background_clr)
            elif (u and j == 1):
                plot_v2(xc, yc + 1, alp, xShift, markers, color, background_clr)
            elif (r and j == 2):
                plot_v2(xc + 1, yc, alp, xShift, markers, color, background_clr)
            elif (d and j == 3):
                plot_v2(xc, yc - 1, alp, xShift, markers, color, background_clr)
            elif (l and j == 4):
                plot_v2(xc - 1, yc, alp, xShift, markers, color, background_clr)
            xc+=1
        yc-=1
                
Leave a Comment