plaruPlot.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import matplotlib.pyplot as plt
  2. import scipy as sc
  3. def fullPlot(eps, sig, epsP, deps):
  4. print("Ploting results ...")
  5. fig, axs = plt.subplots(1, 4, figsize=(20,9))
  6. plt.subplots_adjust(wspace=0.5)
  7. plt.rcParams.update({'font.size': 24})
  8. # Draw axis
  9. for k in range(0, 4):
  10. axs[k].grid()
  11. axs[k].axvline(color = 'black')
  12. axs[k].axhline(color = 'black')
  13. # Plot 1
  14. axs[0].title.set_text("$\\varepsilon \\to \sigma$")
  15. axs[0].set_xlabel("$\\varepsilon$")
  16. axs[0].set_ylabel("$\sigma \, (MPa)$")
  17. axs[0].plot(eps, sig)
  18. # Plot 2
  19. axs[1].title.set_text("$\\varepsilon \\to \\varepsilon_p$")
  20. axs[1].set_xlabel("$\\varepsilon$")
  21. axs[1].set_ylabel("$\\varepsilon_p$")
  22. axs[1].plot(eps, epsP)
  23. # Plot 3
  24. axs[2].title.set_text("$\\varepsilon_p \\to \sigma$")
  25. axs[2].set_xlabel("$\\varepsilon_p$")
  26. axs[2].set_ylabel("$\sigma \, (MPa)$")
  27. axs[2].plot(epsP, sig)
  28. # Plot 4
  29. axs[3].title.set_text("$k \\to d\\varepsilon_p$")
  30. axs[3].set_xlabel("k")
  31. axs[3].set_ylabel("$d\\varepsilon_p$")
  32. axs[3].plot(deps, marker='+')
  33. # Better scale
  34. xadd = 0.2
  35. yadd = 0.2
  36. for k in range(0, 4):
  37. lft, rig = axs[k].get_xlim()
  38. lft -= xadd
  39. axs[k].set_xlim(lft, rig)
  40. lft, rig = axs[k].get_ylim()
  41. lft -= yadd
  42. rig += yadd
  43. axs[k].set_ylim(lft, rig)
  44. plt.show()