我有图表y = tan(x),我想删除垂直线(见下文)。
这是我的代码:
import numpy as np
import matplotlib.pyplot as plt
# Choose evenly spaced x intervals
x = np.arange(-2*np.pi, 2*np.pi, 0.1)
# plot y = tan(x)
plt.plot(x, np.tan(x))
# Set the range of the axes
plt.axis([-2*np.pi, 2*np.pi, -2, 2])
# Include a title
plt.title('y = tan(x)')
# Optional grid-lines
plt.grid()
# Show the graph
plt.show()
Run Code Online (Sandbox Code Playgroud)
这是图表(包括不需要的垂直线):
我可以删除垂直线而不在 x 间隔中设置适当的间隙吗?