Search code examples
pythonnumpymatplotlibplotfluid-dynamics

Python - Plot showing Empty


I am trying to plot the following:

#Time
for t in np.arange(1,10,1):
    #Raidus
    for r in np.arange(1,5,1):
        #Velocity in theta direction
        V = C/r*(1-np.exp(-r**2/(4*v*t)))
        print(r,V)
        #Vorticity
        Z = C*((1/(2*v*t))*np.exp(-r**2/(4*v*t))-(1-np.exp(-r**2/(4*v*t)))/r**2)
    
     plt.plot(r,V)

When I print(r,V) python does show 9 tables (each for a different t) with radius from 1-4. However, when I plot, the plot looks completely empty.

Thanks for the help.


Solution

  • Save the r and the v in two lists. Append the list in each loop with a new r and a new v.

    After the interior loop, pass the lists to the plot and empty them.