Matplotlib/pyplot: How to enforce axis range?

前端 未结 4 1692
时光取名叫无心
时光取名叫无心 2020-12-14 05:40

I would like to draw a standard 2D line graph with pylot, but force the axes\' values to be between 0 and 600 on the x, and 10k and 20k on the y. Let me go with an example.

4条回答
  •  悲&欢浪女
    2020-12-14 06:15

    To answer my own question, the trick is to turn auto scaling off...

    p.axis([0.0,600.0, 10000.0,20000.0])
    ax = p.gca()
    ax.set_autoscale_on(False)
    

提交回复
热议问题