简单的Axisartist1

简单的Axisartist1

  1. import matplotlib.pyplot as plt
  2. import mpl_toolkits.axisartist as AA
  3. fig = plt.figure(1)
  4. fig.subplots_adjust(right=0.85)
  5. ax = AA.Subplot(fig, 1, 1, 1)
  6. fig.add_subplot(ax)
  7. # make some axis invisible
  8. ax.axis["bottom", "top", "right"].set_visible(False)
  9. # make an new axis along the first axis axis (x-axis) which pass
  10. # through y=0.
  11. ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0,
  12. axis_direction="bottom")
  13. ax.axis["y=0"].toggle(all=True)
  14. ax.axis["y=0"].label.set_text("y = 0")
  15. ax.set_ylim(-2, 4)
  16. plt.show()

下载这个示例