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.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()
Here is the graph (including unwanted vertical lines):
Can I remove the vertical lines without setting appropriate gaps into the x intervals?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…