Issue
There are only 4 types of line style in matplotlib: ['--', '-.', '-', ':']. Can one make more than 4 different types of line style in matplotlib?
Solution
You can create far more than these four types using the dashes
argument to specify custom dash styles. For example:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10)
y = np.sin(x)
plt.plot(x, y, dashes=[10, 5, 20, 5], linewidth=2, color='black')
The dashes
argument is a list of integers which specify the size of dashes and spaces in points: in the example above there is a 10-point dash, a 5-point space, a 20-point dash, and another 5-point space, and then the sequence repeats.
Answered By - jakevdp
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.