December 2017
Intermediate to advanced
386 pages
10h 42m
English
The line plots with different line styles are produced with the following code:
plt.plot(xvalues, ls = '-', color='green')plt.plot(xvalues + 1, ls = '--', color='green')plt.plot(xvalues + 2, ls = ':', color='green')plt.plot(xvalues + 3, ls = '-.', color='green')
The line style is set with the ls option, which accepts the values shown in the following table:
|
Option |
Line style |
|
'-' or 'solid' |
Solid line |
|
'--' or 'dashed' |
Dashed line |
|
'-.' or 'dashdot' |
Dashed-dotted line |
|
':' or 'dotted' |
Dotted line |
| None, ' ' or '' | Blank line |
In the second subplot, we demonstrate the use of markers with the following code:
plt.plot(xvalues, marker='o', ls='', color='blue')plt.plot(xvalues + 1, marker='^', ls='', color='blue') ...
Read now
Unlock full access