Omit joining lines in matplotlib plot e.g. y = tan(x)

前端 未结 4 1070
囚心锁ツ
囚心锁ツ 2020-12-04 01:48

I have the graph y = tan(x) and I want to remove the vertical lines (see below).

Here is my code:

import numpy as np
import matplotlib.p         


        
4条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 02:47

    If you're willing to have the overhead of a more powerful mathematical program, SageMath can help with this:

    plot(tan(x),(x,-2*pi,2*pi),detect_poles=True,ymin=-2,ymax=2,ticks=[pi/2,None],tick_formatter=pi)
    

    (The little opening at the origin is something I've not seen before, hopefully fixed again soon.)

提交回复
热议问题