import numpy as np
import matplotlib.pyplot as plt

def descartes(ax, ran_x, ran_y, ax_title,x_label = "x", y_label = "y"):
    ax.set_xlabel(x_label, fontsize = 12)
    ax.set_ylabel(y_label, fontsize = 12)
    ax.set_xlim(ran_x[0], ran_x[1])
    ax.set_ylim(ran_y[0], ran_y[1])
    ax.set_title(ax_title, fontsize = 14)
    ax.grid()
    ax.axhline(0, color = "black")
    ax.axvline(0, color = "black")

fig = plt.figure(figsize = (5, 5))
ax = fig.add_subplot(111)

title1 = "Tokyo University 2023 Math qu.3 NO1"
descartes(ax, [-3,0.1], [-8, 6],title1,x_label="t")

s1=7/8
e1=13/8
cmap = plt.get_cmap('jet')
num = 30 
i=0

for a in np.linspace(s1,e1,num):
    i+=1
    ii = i/num
    t=np.linspace(-3,1,1000)
    y=t**4+4*t**3+(4*a-1)*t**2
    ax.plot(t ,y , color = cmap(ii))

a=5/4
y=t**4+4*t**3+(4*a-1)*t**2
ax.plot(t ,y , color = "green")

a=11/8
y=t**4+4*t**3+(4*a-1)*t**2
ax.plot(t ,y , color = "green")

plt.show()