This code only gives an empty window. I try to plot a graph with two lines. Is there any way to attach the graph to the window? Thanks!
import matplotlib.pyplot as plt
import numpy as np
alpha =np.deg2rad(np.linspace(0,180,1000))
sigma_1=190 #kPa
sigma_3=145 #kPa
sigma_delta=(sigma_1+sigma_3)/2 + ( (sigma_1-sigma_3)/2 ) * np.cos(2*alpha) #kPa
def sigma_alpha(s1,s3,a):
return ( (s1+s3)/2 + ( (s1-s3)/2 ) * np.cos(2*alpha) )
def tau_alpha(s1,s3,a):
return (( (s1-s3)/2 )*np.sin(2*alpha) )
plt.figure(figsize=(18,10))
plt.plot(alpha, sigma_alpha(sigma_1, sigma_3, alpha), label=r'$sigma_{$alpha$}$', linewidth=3, color='green')
plt.plot(alpha, tau_alpha(sigma_1, sigma_3, alpha), label = r'$tau_{$alpha$}$', linewidth=3, color='red')
plt.xlabel('Angle $\alpha$ [u"\N{DEGREE SIGN}"]')
plt.ylabel('Spenning[kPa]')
plt.title('Spenningsvariasjon for plan $alpha$ = 0-180')
plt.legend(loc=5, framealpha=1, prop={'size':18})
plt.grid()
plt.minorticks_on()
plt.grid(b=None, which='both', axis='x', linewidth=0.5, linestyle='-')
plt.grid(b=None, which='both', axis='y', linewidth=0.5, linestyle='-')
plt.show()