Lineplot not showing in pyplot?

Question:

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()
Asked By: Bholu

||

Answers:

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.

Answered By: Niyaz
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.