To draw more type of lines in Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Create x and y data points using numpy.
- Plot x and y data points using plot() method, with an array of dashes.
- To display the figure, use show() method.
Example
from matplotlib import pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(-10, 10, 100) y = np.sin(x) plt.plot(x, y, dashes=[1, 1, 2, 1, 3], linewidth=7, color='red') plt.show()