Help with Matplotlib Error

I am having trouble with getting subplots working for a specific piece of code.
I am trying to get two existing plots to show up on one plot.
One of the plots shows up but the other does not, and I have no clue why. I am a very early beginner in python so any help is greatly appreciated.
I know the code is messy, and I appreciate anyone who takes the time to help.

I get the following error:

File C:\Program Files\Spyder\pkgs\matplotlib\axes_base.py:465 in _plot_args
raise ValueError(“x, y, and format string must not be None”)

ValueError: x, y, and format string must not be None
here is the figure



import numpy as np
import matplotlib.pyplot as plt

global TmS
TmS = 1500

global tl
tl = 40

global RAL
RAL = 0
global RBL
RBL = 40

gear_count = 2
PressureAngle = 20

F1Radius = 4
F1L = 10
F1_Gear_Plane = 0

F2Radius = 5
F2L = 28
F2_Gear_Plane = 135

input_gear = 1

def Force_Solver_Trig():

    if input_gear == 1:
        global F1Tan
        global F1Rad
        global F1
        global F1_y
        global F1_z
        
        global RA_y
        global RA_z
        global RA
        
        global RB_y
        global RB_z
        global RB
        
        global F2Tan
        F2Tan = 0
        global F2Rad
        F2Rad = 0
        global F2
        F2 = 0
        global F2_y
        F2_y = 0
        global F2_z
        F2_z = 0
        
        F1Tan = TmS/F1Radius
        F1Rad = F1Tan*np.tan(PressureAngle*((2*np.pi)/360))
        
        
        F1 = np.sqrt(F1Rad**2 + F1Tan**2)
        
        F1_y = -1*np.cos(F1_Gear_Plane*((2*np.pi)/360))*F1  # multiplied by -1 to follow sign convention only
        F1_z = -1*np.sin(F1_Gear_Plane*((2*np.pi)/360))*F1
        
        print("F1_y is ", F1_y)
        print("F1_z is ", F1_z)
        print("F1 is ", F1)
        print()
        
        if gear_count == 1:
            
            RB_y = -(F1L/RBL)*F1_y           
            
            RA_y = -(F1_y + RB_y)
        
            RB_z = -(F1L/RBL)*F1_z
            RA_z = -(F1 + RB_z)
        
            RB = np.sqrt(RB_y**2 + RB_z**2)
            RA = np.sqrt(RA_y**2 + RB_z**2)
        
        elif gear_count == 2:

            F2Tan = TmS/F2Radius
            F2Rad = F2Tan*np.tan(PressureAngle*((2*np.pi)/360))
           
            F2 = np.sqrt(F2Rad**2 + F2Tan**2)
           
            F2_y = -1*np.cos(F2_Gear_Plane*((2*np.pi)/360))*F2   # multiplied by -1 to follow sign convention only
            F2_z = -1*np.sin(F2_Gear_Plane*((2*np.pi)/360))*F2
            
            print("F2_y is ", F2_y)
            print("F2_z is ", F2_z)
            print("F2 is ", F2)
            print()
        
            RB_y = -(((F1L - RAL)*F1_y) + ((F2L - RAL)*F2_y))/((RBL - RAL))
            RB_z = -(((F1L - RAL)*F1_z) + ((F2L - RAL)*F2_z))/((RBL - RAL))
            RB = np.sqrt(RB_y**2  +  RB_z**2)
            
            print("RB_y is ", RB_y)
            print("RB_z is ", RB_z)
            print("RB is ", RB)
            print()
            
            RA_y = -(F1_y + F2_y + RB_y)
            RA_z = -(F1_z + F2_z + RB_z)
            RA = np.sqrt(RA_y**2 + RA_z**2)
            
            print("RA_y is ", RA_y)
            print("RA_z is ", RA_z)
            print("RA is ", RA)
            print()
       
    return F1Tan, F1Rad, F1, F1_y, F1_z, F2Tan, F2Rad, F2, F2_y, F2_z, RB_y, RB_z, RB, RA_y, RA_z, RA

#F1Tan, F1Rad, F1, F1_y, F1_z, F2Tan, F2Rad, F2, F2_y, F2_z, RB_y, RB_z, RB, RA_y, RA_z, RA = Force_Solver_Trig():

def truncate(TruncTerm, decimals):
    multiplier = 10 ** decimals
    return int(TruncTerm * multiplier)/multiplier    


def FBD_Plot(M, X, V, T, h, h2):
    plt.rcParams["figure.autolayout"] = True
    fig_vars[h2] = plt.figure("Figure %d" % h2)
    plt.gcf().set_dpi(400)
    plt.plot(X,M)
    plt.plot(X,V)
    plt.plot(X,T)
    plt.grid(True)
    plt.legend(['Moment, M', 'Shear, V', 'Torque, T'])
    plt.title('Moment, Shear, and Torque/10 Diagrams, on the axis')
    plt.ylabel('M(lb*in), V(lb), T(in*lb)/10')
    plt.fill_between(X, M, alpha = 0.4)
    plt.fill_between(X, V, alpha = 0.4)
    
    plt.show()
    
    h2 = h2 + 1
    return 


def Single_Gear_FBD_Diagram(h2):
        #--------------------------------------------------------------------------------------------
        #    FBD Plotting
        #--------------------------------------------------------------------------------------------
        plt.rcParams["figure.autolayout"] = True
        #fig_vars[h2] = plt.figure("Figure %d" % h2)
        #fig1 = Figure(figsize = (10, 10), dpi = 400)
        
        plt.title('Free Body Diagram  X-%d Plane')
        #plt.subtitle('Forces Found by Moments About A')
        plt.xlabel('X (in)')
        #plt.ylabel('in')
        #plt.grid()
        #plt.fill_between(X, YR, alpha = 0.4)
        plt.xlim(-tl*0.06, tl + tl*0.06)
        plt.ylim(-2,2)
        fbdbarwidth = fbw = 0.2
        hl = fbw/2
        arw = fbw/1.8
        rectangle20 = plt.Rectangle((-tl*0.015,0), tl + tl*0.03 ,fbw, fc = 'grey', ec = 'black')
        hw = fbw/2
        hl = 0.3
        hw = 0.5
        arw = 0.03
        arl = 0.75
         
        if F1in > 0:    
            plt.arrow(F1L,arl + fbw, 0, - (arl-hl) , fc='red', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(F1L - 0.03*tl, arl + fbw +0.1, truncate(F1in, 1))
            plt.text(F1L, -0.2, 'F1in')
        else:
            plt.arrow(F1L,-arl, 0, (arl-hl) , fc='red', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(F1L - 0.03*tl, -arl - 0.2, truncate(F1in, 1) )
            plt.text(F1L, fbw + 0.1, 'F1in')
              
        if RAin < 0:    
            plt.arrow(RAL,arl + fbw, 0, - (arl-hl) , fc='black', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(RAL - 0.03*tl, arl + fbw + 0.1, truncate(RAin,1))
            plt.text(RAL, -0.2, 'A')
        else:
            plt.arrow(RAL,-arl, 0, (arl-hl) , fc='black', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(RAL - 0.03*tl, -arl - 0.2, truncate(RAin,1) )
            plt.text(RAL, fbw + 0.1, 'A')
        
            
            
        if RBin < 0:    
            plt.arrow(RBL,arl + fbw, 0, - (arl-hl) , fc='black', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(RBL - 0.03*tl, arl + fbw + 0.1, truncate(RBin, 1))
            plt.text(RBL - 0.03*tl, -0.2, 'B')
            
        else:
            plt.arrow(RBL,-arl, 0, (arl-hl) , fc='black', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(RBL - 0.03*tl, -arl - 0.2, truncate(RBin, 1) )
            plt.text(RBL - 0.03*tl, fbw + 0.1, 'B')
        
        circle1 = plt.Circle((RAL, fbw/2), fbw/4, fc='black',ec="black")
        circle2 = plt.Circle((RBL, fbw/2), fbw/4, fc='black',ec="black")
        circle3 = plt.Circle((F1L, fbw/2), fbw/4, fc='black',ec="black")
        circle4 = plt.Circle((F1L, fbw/2), fbw/4, fc='black',ec="black")
        
        ax = plt.gca()
        ax.get_yaxis().set_visible(False)
        
        plt.gca().add_patch(rectangle20)
        #plt.gca().add_patch(rectangle21)
        #plt.gca().add_patch(rectangle22)
        plt.gca().add_patch(circle1)
        plt.gca().add_patch(circle2)
        plt.gca().add_patch(circle3)
        plt.gca().add_patch(circle4)
        plt.gcf().set_dpi(100)


def Double_Gear_FBD_Diagram(h2):
        plt.rcParams["figure.autolayout"] = True
        #fig_vars[h2] = plt.figure("Figure %d" % h2)
        
        plt.title('Free Body Diagram X-')
        #plt.subtitle('Forces Found by Moments About A')
        plt.xlabel('X (in)')
        #plt.ylabel('in')
        #plt.grid()
        #plt.fill_between(X, YR, alpha = 0.4)
        plt.xlim(-4, tl + 4)
        plt.ylim(-2,2)
        fbdbarwidth = fbw = 0.2
        hl = fbw/2
        arw = fbw/1.8
        FBDbar_rectangle = plt.Rectangle((-tl*0.015,0), tl + tl*0.03 ,fbw, fc = 'grey', ec = 'black')
        hw = fbw/1.6
        hl = 0.2
        hw = 0.6
        arw = 0.03
        arl = 0.75
         
        if F1in > 0:    
            plt.arrow(F1L,arl + fbw, 0, - (arl-hl) , fc='red', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(F1L - 0.03*tl, arl + fbw +0.1, truncate(F1in, 1))
            plt.text(F1L, -0.2, 'F1in')
        else:
            plt.arrow(F1L,-arl, 0, (arl-hl) , fc='red', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(F1L - 0.03*tl, -arl - 0.2, truncate(F1in, 1) )
            plt.text(F1L, fbw + 0.1, 'F1in')
        
        if F2in > 0:    
            plt.arrow(F2L,arl + fbw, 0, - (arl-hl) , fc='red', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(F2L - 0.03*tl, arl + fbw + 0.1, truncate(F2in, 1))
            plt.text(F2L, -0.2, 'F2in')
        else:
            plt.arrow(F2L,-arl, 0, (arl-hl) , fc='red', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(F2L - 0.03*tl, -arl - 0.2, truncate(F2in,1) )
            plt.text(F2L, fbw + 0.1, 'F2in')
        
        rectangle21 = plt.Rectangle((0,3),tl ,0.2, fc = 'grey', ec = 'black')
        rectangle22 = plt.Rectangle((0,-3),tl ,0.2, fc = 'grey', ec = 'black')
        
        if RAin < 0:    
            plt.arrow(RAL,arl + fbw, 0, - (arl-hl) , fc='black', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(RAL - 0.03*tl, arl + fbw + 0.1, truncate(RAin,1))
            plt.text(RAL, -0.2, 'A')
        else:
            plt.arrow(RAL,-arl, 0, (arl-hl) , fc='black', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(RAL - 0.03*tl, -arl - 0.2, truncate(RAin,1) )
            plt.text(RAL, fbw + 0.1, 'A')
            
        if RBin < 0:    
            plt.arrow(RBL,arl + fbw, 0, - (arl-hl) , fc='black', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(RBL - 0.03*tl, arl + fbw + 0.1, truncate(RBin, 1))
            plt.text(RBL - 0.03*tl, -0.2, 'B')
            
        else:
            plt.arrow(RBL,-arl, 0, (arl-hl) , fc='black', ec='black', width = arw, head_width = hw, head_length = hl )
            plt.text(RBL - 0.03*tl, -arl - 0.2, truncate(RBin, 1) )
            plt.text(RBL - 0.03*tl, fbw + 0.1, 'B')
        
        RA_circle = plt.Circle((RAL, fbw/2), fbw/4, fc='black',ec="black")
        RB_circle = plt.Circle((RBL, fbw/2), fbw/4, fc='black',ec="black")
        F1_circle = plt.Circle((F1L, fbw/2), fbw/4, fc='black',ec="black")
        F2_circle = plt.Circle((F2L, fbw/2), fbw/4, fc='black',ec="black")
        
        ax = plt.gca()
        ax.get_yaxis().set_visible(False)
            
        plt.gca().add_patch(FBDbar_rectangle)
        #plt.gca().add_patch(rectangle21)
        #plt.gca().add_patch(rectangle22)
        plt.gca().add_patch(RA_circle)
        plt.gca().add_patch(RB_circle)
        plt.gca().add_patch(F1_circle)
        plt.gca().add_patch(F2_circle)
        
        plt.gcf().set_dpi(400)
        
        h2 = h2 + 1
        
        
        
        
        
# =============================================================================
#         wingen = wingen_text.get()
# 
#         if wingen == 1:
#             
#     
#             canvas2 = FigureCanvasTkAgg(fig8, master = Force_Window)
#             #canvas2.draw()
#             canvas2.get_tk_widget().pack()
#             # creating the Matplotlib toolbar
#             toolbar = NavigationToolbar2Tk(canvas2, Force_Window)
#             toolbar.update()
#             plt.title('FBD Diagram')
#             # placing the toolbar on the Tkinter window
#             canvas2.get_tk_widget().pack
#                     
#         
#         canvas3 = FigureCanvasTkAgg(fig8, master = root)
#         #canvas2.draw()
#         canvas3.get_tk_widget().pack()
#         # creating the Matplotlib toolbar
#        # toolbar = NavigationToolbar2Tk(canvas3, root)
#        # toolbar.update()
#         plt.title('FBD Diagram')
#         # placing the toolbar on the Tkinter window
#         canvas3.get_tk_widget().place(x=700, y=40)
#                 
# =============================================================================
        
        #plt.close(fig8)
        



def Force_Array_Calc():
    global l
    global nl
    Xout = []
    Vout = []
    Mout = []
    Tout = []
    nl =  100000
    l = np.linspace(0,tl,nl)

    #######################################
    if gear_count == 1:
        #---------------
        for x in l+0.001:
            if x <= RAL:
                t = 0
                v = 0
                m = 0
            elif RAL < x <= F1L:
                t = 0 #Tmax/10
                v = RA
                m = v*(x - RAL)
                m1 = RA*(F1L - RAL)
            elif F1L < x <= RBL:
                t = TmS
                v = RA - F1
                m = v*(x - F1L) + m1   
            elif x <= tl:
                t = TmS    
                v = 0
                m = 0
            elif x <= tl + 0.01:
                t = 0
                v = 0
                m = 0
        #---------------
            Mout.append(m)
            Xout.append(x)
            Vout.append(v)
            Tout.append(t)
    #------------------------------------------
    elif gear_count == 2:
        #---------------
        for x in l+0.001:
            if x <= RAL:
                t = 0
                v = 0
                m = 0
            elif RAL < x <= F1L:
                t = 0 #Tmax/10
                v = RAin
                m = RAin*(x - RAL)
                m1 = RAin*(F1L - RAL)
        
            elif F1L < x <= F2L:
                t = TmS/10
                v = RAin + F1in
                m = v*(x - F1L) + m1
                m2 = v*(F2L - F1L) + m1
            elif F2L < x <= tl:
                t = 0 
                v = RAin + F1in + F2in
                m = v*(x - F2L) + m2
            elif x <= tl + 0.01:
                t = 0
                v = 0
                m = 0
       #---------------     
            Mout.append(m)
            Xout.append(x)
            Vout.append(v)
            Tout.append(t)
    #########################################        
    return Mout, Xout, Vout, Tout, l
    




def MVTX_Smart_Plot():
    global h
    h = 50
    global F1in
    global F2in
    global RAin
    global RBin
    global fig_vars
    global RB_y
    global RB_z
    global F1_y
    global F1_z
    global fig1
    global fig2
    
    fig_vars = {}
    for i in range(h):
        fig_name = "fig%d" % i
        fig_vars[fig_name] = "fig%d" % i
    print(fig_vars["fig2"])
    global axisname
    global h2
    h2 = 0
    
    
    
    if gear_count == 1:
        RAin = RA_y
        RBin = RB_y
        F1in = F1_y
        axisname = "y"
        
        fig1 = Single_Gear_FBD_Diagram(h2)
        Mout, Xout, Vout, Tout, l = Force_Array_Calc()
        
        My = M = Mout
        Xy = X = Xout
        Vy = V = Vout
        Ty = T = Tout
        
        fig2 = FBD_Plot(M, X, V, T, axisname, h2)
        
        RAin = RA_z
        RBin = RB_z
        F1in = F1_z
        axisname = "z"
        
        fig3 = Single_Gear_FBD_Diagram(h2)
        Force_Array_Calc()
        
        Mz = M = Mout
        Xz = X = Xout
        Vz = V = Vout
        Tz = T = Tout
        
        fig4 = FBD_Plot(M, X, V, T, axisname, h2)
        
        
    elif gear_count == 2:
        
        
        RAin = RA_y
        RBin = RB_y
        F1in = F1_y
        F2in = F2_y
        axisname = "y"
        
       
        fig1 = Double_Gear_FBD_Diagram(h2)
        Mout, Xout, Vout, Tout, l = Force_Array_Calc()
        
        

        My = M = Mout
        Xy = X = Xout
        Vy = V = Vout
        Ty = T = Tout
    
        fig2 = FBD_Plot(M, X, V, T, axisname, h2)
       
        
        RAin = RA_z
        RBin = RB_z
        F1in = F1_z
        F2in = F2_z
        axisname = "z"
        
        fig3 = Double_Gear_FBD_Diagram(h2)
        Mout, Xout, Vout, Tout, l = Force_Array_Calc()
        
    
        Mz = M = Mout
        Xz = X = Xout
        Vz = V = Vout
        Tz = T = Tout
        
        fig4 = FBD_Plot(M, X, V, T, axisname, h2)
    
        
        
    fig50, (ax1, ax2) = plt.subplots(2,1, figsize = (6,5))
    ax1.plot(Double_Gear_FBD_Diagram(h2))
    ax2.plot(Double_Gear_FBD_Diagram(h2))
    plt.show(fig50)
    
 
    
    plt.show()
    
    Mysqrd = []
    Mysqrd = My
    
    Mzsqrd = []
    Mzsqrd = Mz
    
    Mysqrd = [i**2 for i in Mysqrd]
    Mzsqrd = [i**2 for i in Mzsqrd]
    
    Mres = []
    Mres = [np.sqrt(i + j) for i,j in zip(Mysqrd, Mzsqrd)]
    
    Vysqrd = []
    Vysqrd = Vy
    
    Vzsqrd = []
    Vzsqrd = Vz
    
    Vysqrd = [i**2 for i in Vysqrd]
    Vzsqrd = [i**2 for i in Vzsqrd]
    
    Vres = [np.sqrt(i + j) for i,j in zip(Vysqrd, Vzsqrd)]
    
    M = Mres
    
    V = Vres
    
    FBD_Plot(M, X, V, T, axisname, h2)
    



    #======================================

Force_Solver_Trig()
MVTX_Smart_Plot()


# =============================================================================
# =============================================================================
# global h
# h = 50
# 
# 
# fig_vars = {}
# for i in range(h):
#     fig_name = "fig%d" % i
#     fig_vars[fig_name] = "fig%d" % i
# print(fig_vars["fig2"])
# global axisname
# global h2
# h2 = 0
# 
# if gear_count == 1:
#     RAin = RA_y
#     RBin = RB_y
#     F1in = F1_y
#     axisname = "y"
#     
#     fig1, ax1 = plt.subplots()
#     fig1 = Single_Gear_FBD_Diagram()
#     Mout, Xout, Vout, Tout, l = Force_Array_Calc()
#     
#     My = M = Mout
#     Xy = X = Xout
#     Vy = V = Vout
#     Ty = T = Tout
#     
#     fig2, ax2 = plt.subplots()
#     FBD_Plot(M, X, V, T, axisname, h2)
#     
#     RAin = RA_z
#     RBin = RB_z
#     F1in = F1_z
#     axisname = "z"
#     
#     Single_Gear_FBD_Diagram()
#     Force_Array_Calc()
#     
#     My = M = Mout
#     Xy = X = Xout
#     Vy = V = Vout
#     Ty = T = Tout
#     
#     FBD_Plot(M, X, V, T, axisname, h2)
#     
#     
# elif gear_count == 2:
#    
#     RAin = RA_y
#     RBin = RB_y
#     F1in = F1_y
#     F2in = F2_y
#     axisname = "y"
#     
#     Double_Gear_FBD_Diagram()
#     Mout, Xout, Vout, Tout, l = Force_Array_Calc()
# 
#     My = M = Mout
#     Xy = X = Xout
#     Vy = V = Vout
#     Ty = T = Tout
# 
#     FBD_Plot(M, X, V, T, axisname, h2)
#    
#     
#     RAin = RA_z
#     RBin = RB_z
#     F1in = F1_z
#     F2in = F2_z
#     axisname = "z"
#     
#     Double_Gear_FBD_Diagram()
#     Mout, Xout, Vout, Tout, l = Force_Array_Calc()
# 
#     Mz = M = Mout
#     Xz = X = Xout
#     Vz = V = Vout
#     Tz = T = Tout
# 
#     FBD_Plot(M, X, V, T, axisname, h2)
#     
# Mysqrd = []
# Mysqrd = My
# 
# Mzsqrd = []
# Mzsqrd = Mz
# 
# Mysqrd = [i**2 for i in Mysqrd]
# Mzsqrd = [i**2 for i in Mzsqrd]
# 
# Mres = []
# Mres = [np.sqrt(i + j) for i,j in zip(Mysqrd, Mzsqrd)]
# 
# Vysqrd = []
# Vysqrd = Vy
# 
# Vzsqrd = []
# Vzsqrd = Vz
# 
# Vysqrd = [i**2 for i in Vysqrd]
# Vzsqrd = [i**2 for i in Vzsqrd]
# 
# Vres = [np.sqrt(i + j) for i,j in zip(Vysqrd, Vzsqrd)]
# 
# M = Mres
# 
# V = Vres
# 
# FBD_Plot(M, X, V, T, axisname, h2)
# 
# 
# 
# 
# =============================================================================


Find minimal code exhibiting the issue and experiment with that.

This is the specific piece of code that is giving me issues.
I have been unable to fix the problem, and have tried multiple ways of creating the plot and naming the plot.

      
        
    fig50, (ax1, ax2) = plt.subplots(2,1, figsize = (6,5))
    ax1.plot(Double_Gear_FBD_Diagram(h2))
    ax2.plot(Double_Gear_FBD_Diagram(h2))
    plt.show(fig50)