Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python pltplot graph, show empty graph

I don’t seem to find problem why graph is not showing any lines, its just blank im new in python
"Trying to plot graph maximum height and range with angle"

import matplotlib.pyplot as plt
import numpy as np
def projectile(Vo,Angle):
Acc=9.8
Mheight=(Vo**2)*np.sin(np.radians(Angle**2))/Acc**2
Range=(Vo**2)*(np.sin(np.radians(Angle)))/Acc
plt.plot(int(Mheight),int(Angle)) // This is the line
plt.show()  // only showing blank graph
return ("Maximum Height: ",Mheight,"Maximum Range: ",Range)
#Main Function  
Vo=int(input("Enter Velocity: "))
Angle=int(input("Enter Angle: "))
print(projectile(Vo,Angle))

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You should give plt.plot() a tuple object.

thus, like:

    plt.plot((int(Mheight),int(Angle)))
    plt.show() 

by the way, remember the typesetting of your code.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading