Q:

Plot multiple graph using same graph

I have written one code where I want to plot multiple graphs in a same plot. When I run this, I do not get any result or any error. I am trying to take each value of a and plot graph using the program. So i suppose to have 4 graph as a have 4 elements. Most importantly all graphs shall be in a same figure. Though I am not getting any error or any result I am a bit confuse whether the for loop is working or not. When I use a fixed alpha value and, without using for loop, my code works perfectly. Any idea how to perform that? If my question is not clear please let me know. 
import numpy as np
import matplotlib.pyplot as plt
r=10**-6

a=np.array([10,30,60,90])

E=[]
B=[]
gamma_sa=58.6*10**-3
gamma_sw=25*10**-3
gamma_pa=153*10**-3
gamma_pw=110*10**-3
gamma_aw=72.5*10**-3

kt= 1.38*10**-23*290
i=0
for n in a:
    alpha=n*(np.pi/180)

    while i<360:

        beta=(90-i)*(np.pi/180)
        if i>=alpha*180/np.pi and i<=180-alpha*180/np.pi:
            Energy= 2*np.pi*r**2*(gamma_pw+gamma_sw*np.cos(alpha)+gamma_sa*(1-np.cos(alpha))-0.5*gamma_aw*np.sin(alpha)**2)
        elif i>=180+alpha*180/np.pi and i<=360-alpha*180/np.pi:       
            Energy=2*np.pi*r**2*(gamma_sw+gamma_pw*(np.cos(alpha))+gamma_pa*(1-np.cos(alpha))-0.5*gamma_aw*np.sin(alpha)**2)

        elif i>180-alpha*180/np.pi and i<180+alpha*180/np.pi :
            x=np.arcsin(((1/np.tan(-beta))*(1/np.tan(alpha))))
            w=np.cos(alpha)
            y=np.arctan((np.cos(-beta))/(np.sqrt((np.sin(beta)**2)-(np.cos(alpha)**2))))
            z= (2*r**2)*((x*w)-y)
            A_pa= (np.pi*r**2)*(1-np.cos(alpha))+z
            A_sa=(2*np.pi*r**2)*(1-np.cos(alpha))-A_pa
            A_sw=(2*np.pi*r**2)-A_sa
            A_pw=(2*np.pi*r**2)-A_pa
            Energy= (gamma_sa*A_sa)+(gamma_pa*A_pa)+(gamma_sw*A_sw)+(gamma_pw*A_pw)-(np.pi*r**2*gamma_aw*np.sin(alpha)**2)    
        else:
            x=np.arcsin(((1/np.tan(beta))*(1/np.tan(alpha))))
            w=np.cos(alpha)
            y=np.arctan((np.cos(beta))/(np.sqrt((np.sin(beta)**2)-(np.cos(alpha)**2))))
            z= (2*r**2)*((x*w)-y)
            A_pa= (np.pi*r**2)*(1-np.cos(alpha))+z
            A_sa=(2*np.pi*r**2)*(1-np.cos(alpha))-A_pa
            A_sw=(2*np.pi*r**2)-A_sa
            A_pw=(2*np.pi*r**2)-A_pa
            Energy= (gamma_sa*A_sa)+(gamma_pa*A_pa)+(gamma_sw*A_sw)+(gamma_pw*A_pw)-(np.pi*r**2*gamma_aw*np.sin(alpha)**2)                      
            orientation=i
            i=i+0.1
            E.append(Energy/kt)
            B.append(orientation)

plt.figure(1)
plt.title('Change of surface energy with rotation')
plt.plot(B,E)
plt.grid (axis='both')
plt.xlabel(r'$90^0 $ - $\beta $')
plt.ylabel(r'E($\alpha $)/kT')

plt.show()

A:

The problem is that you are putting the plot command outside the for loop and so the 4 curves will not be plotted. Moreover some of your variables needed to be redefined. Following is the working solution (without the if else statements):
import numpy as np
import matplotlib.pyplot as plt

# r, a, 5 gamma values and kt here

fig = plt.figure(figsize=(8, 6))
for n in a:
    i = 0
    E=[]
    B=[]
    alpha=n*(np.pi/180)
    while i<360:
        # Code here
            .
            .
            .
            Energy= (gamma_sa*A_sa)+(gamma_pa*A_pa)+(gamma_sw*A_sw)+(gamma_pw*A_pw)-(np.pi*r**2*gamma_aw*np.sin(alpha)**2)                      

        orientation=i # Mind the indent. Should be outside elif
        i=i+0.1
        E.append(Energy/kt)
        B.append(orientation)
    plt.plot(B,E, label='$%d^o$'%n) # Mind the indentation here. Should be outside the while loop

plt.title('Change of surface energy with rotation')
plt.grid (axis='both')
plt.xlabel(r'$90^0 $ - $\beta $')
plt.ylabel(r'E($\alpha $)/kT')
plt.legend()
plt.tight_layout()

Output

