Home > front end >  Lineplot not showing in pyplot?
Lineplot not showing in pyplot?

Time:12-25

In this code, plot does not shows up anything but if I use plt.plot(f, final, 'o', color='blue',linewidth=1.5, markersize=4), it works. I could not understand this, Thanks for the help

import matplotlib.pyplot as plt
import numpy as np
    
Temp = np.array([6, 7, 8])
Freq = np.arange(1, 10, 0.1)
    
# nested for loop for 3 plots
for T in Temp:
        for f in Freq:
            def quanta(f,T):
                return(f*T)
            final = quanta(f,T)  
            plt.plot(f, final)
             
plt.show()

CodePudding user response:

because plot originally expects to draw the line, but you give points to it (f and final are numbers). However, providing a marker (o in your case) inside the plot, makes the plot understands that you want to draw multiple points not a line.

  • Related