mpl_code_Axis.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import matplotlib.pyplot as mpl
  2. import matplotlib.transforms as transforms
  3. mpl.ion() # for interactive drawing
  4. fig = mpl.figure()
  5. ax = fig.gca()
  6. xmin, xmax, ymin, ymax = 0.0, 15.0, -7.0, 8.0
  7. ax.set_xlim(xmin, xmax)
  8. ax.set_ylim(ymin, ymax)
  9. ax.set_aspect('equal')
  10. # line
  11. x = [12.240192378864668, 12.5]
  12. y = [2.150000000000001, 2.0000000000000004]
  13. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
  14. # line
  15. x = [7.5, 12.5]
  16. y = [2.0, 2.0000000000000004]
  17. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
  18. # line
  19. x = [12.240192378864668, 12.5]
  20. y = [1.8499999999999999, 2.0000000000000004]
  21. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
  22. ax.text(12.8333, 2, 'x',
  23. horizontalalignment='center', fontsize=14)
  24. # line
  25. x = [7.35, 7.5]
  26. y = [6.740192378864668, 7.0]
  27. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
  28. # line
  29. x = [7.5, 7.5]
  30. y = [2.0, 7.0]
  31. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
  32. # line
  33. x = [7.65, 7.5]
  34. y = [6.740192378864668, 7.0]
  35. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='solid')
  36. ax.text(7.5, 7.33333, 'y',
  37. horizontalalignment='center', fontsize=14)
  38. mpl.draw()
  39. # line
  40. x = [11.034779889691228, 11.33022221559489]
  41. y = [5.161843595132618, 5.213938048432697]
  42. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
  43. # line
  44. x = [7.5, 11.33022221559489]
  45. y = [2.0, 5.213938048432697]
  46. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
  47. # line
  48. x = [11.22761617259719, 11.33022221559489]
  49. y = [4.932030262196924, 5.213938048432697]
  50. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
  51. ax.text(11.5856, 5.4282, 'x',
  52. horizontalalignment='center', fontsize=14)
  53. # line
  54. x = [4.338156404867384, 4.286061951567303]
  55. y = [5.534779889691228, 5.83022221559489]
  56. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
  57. # line
  58. x = [7.5, 4.286061951567303]
  59. y = [2.0, 5.83022221559489]
  60. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
  61. # line
  62. x = [4.567969737803077, 4.286061951567303]
  63. y = [5.727616172597189, 5.83022221559489]
  64. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dashed')
  65. ax.text(4.0718, 6.08557, 'y',
  66. horizontalalignment='center', fontsize=14)
  67. mpl.draw()
  68. # line
  69. x = [6.824595394571309, 6.631759111665348]
  70. y = [-2.694225432125347, -2.92403876506104]
  71. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
  72. # line
  73. x = [7.5, 6.631759111665348]
  74. y = [2.0, -2.92403876506104]
  75. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
  76. # line
  77. x = [6.5291530686676476, 6.631759111665348]
  78. y = [-2.642130978825267, -2.92403876506104]
  79. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
  80. ax.text(6.57388, -3.25231, 'x',
  81. horizontalalignment='center', fontsize=14)
  82. # line
  83. x = [12.194225432125346, 12.424038765061042]
  84. y = [1.3245953945713098, 1.1317591116653478]
  85. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
  86. # line
  87. x = [7.5, 12.424038765061042]
  88. y = [2.0, 1.1317591116653478]
  89. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
  90. # line
  91. x = [12.142130978825266, 12.424038765061042]
  92. y = [1.029153068667647, 1.1317591116653478]
  93. [line] = ax.plot(x, y, 'r', linewidth=2, linestyle='dotted')
  94. ax.text(12.7523, 1.07388, 'y',
  95. horizontalalignment='center', fontsize=14)
  96. mpl.draw()
  97. mpl.title("Axis")
  98. mpl.draw()
  99. mpl.savefig("tmp_Axis.png", dpi=None)
  100. mpl.savefig("tmp_Axis.pdf")