Advertisement
Sirallens

Untitled

Sep 29th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2.  
  3. print("Stress vs Strain Diagram Maker")
  4.  
  5. xlist = [0]
  6. ylist = [0]
  7.  
  8. points_to_graph = 0
  9.  
  10. while points_to_graph < 4:
  11.    points_to_graph = int(input("How many points you want to graph (at least 4) \n"))
  12.  
  13. for x in range(points_to_graph):
  14.    
  15.     stress = float(input("Provide Stress for point {} \n".format(x+1)))
  16.     strain = decimal(input("Provide Strain for point {} \n".format(x+1)))
  17.    
  18.     ylist.append(stress)
  19.     xlist.append(strain)
  20.  
  21.  
  22.  
  23. print(xlist)
  24. print(ylist)
  25.  
  26. plt.plot(xlist, ylist)
  27. plt.ylabel('Stress')
  28. plt.xlabel('Strain')
  29. plt.axis([0,5.0, 0, 20])
  30. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement