##First Draw Your Data

#!/usr/bin/python
## plot.py
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(1, 5)
plt.plot(x, x*1.5, label='Normal')
plt.plot(x, x*3.0, label='Fast')
plt.plot(x, x/3.0, label='Slow')
plt.grid(True)
plt.title('Sample Growth of a Measure')
plt.xlabel('Samples')
plt.ylabel('Values Measured')
plt.legend(loc='upper left')
plt.savefig('plot.png')

####The png file of the code plot.png

##Then Try to Control Style

###1. Control color

Color abbreviationColor Name
bblue
ccyan
ggreen
kblack
mmagenta
rred
wwhite
yyellow
#!/usr/bin/python
## controlcolor.py
import matplotlib.pyplot as plt
import numpy as np
y = np.arange(1, 3)
plt.plot(y, 'y')
plt.plot(y+1, 'm')
plt.plot(y+2, 'c')
plt.plot(y+3, 'b')
plt.plot(y+4, 'g')
plt.plot(y+5, 'k')
plt.plot(y+6, 'r')
plt.plot(y+7, 'w')
plt.savefig('controlcolor.png')

####The png file of the code controlcolor.png

###2. Control Line Style

Style abbreviationStyle
-solid line
--dashed line
-.dash-dot line
:dotted line
#!/usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
y = np.arange(1, 3)
plt.plot(y, '-', y+1, '-.', y+2, ':', y+3, '--')
plt.savefig("controlLineStyle.png")

####The png file of the code controlLineStyle.png

###3. Control Marker Style

Marker abbreviationMarker style
.Point marker
,Pixel marker
oCircle marker
vTriangle down marker
^Triangle up marker
<Triangle left marker
>Triangle right marker
1Tripod down marker
2Tripod up marker
3Tripod left marker
4Tripod right marker
sSquare marker
pPentagon marker
*Star marker
hHexagon marker
HRotated hexagon marker
+Plus marker
xCross (x) marker
DDiamond marker
dThin diamond marker
|Vertical line (vline symbol) marker
-Horizontal line (hline symbol) marker
#!/usr/bin/python
## controlMarker.py
import matplotlib.pyplot as plt
import numpy as np
y = np.arange(1, 3, 0.2)
plt.plot(y, 'x', y+0.5, 'o', y+1, 'D', y+1.5, '^', y+2, 's')
plt.plot(y+2.5, '.', y+3, ',', y+3.5, 'v', y+4, '<', y+4.5, '>')
plt.plot(y+5, '+', y+5.5, '|', y+6, '-', y+6.5, 'd')
plt.savefig("controlMarker.png")

####The png file of the code controlMarker.png

###4. Mix above

#!/usr/bin/python
## controlMix.py
import matplotlib.pyplot as plt
import numpy as np
y = np.arange(1, 3, 0.2)
plt.plot(y, 'cx--', y+1, 'mo:', y+2, 'kp-.')
plt.savefig("controlMix.png")

####The png file of the code controlMix.png

###5. Control with Keywords

#!/usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
y = np.arange(1, 3, 0.3)
plt.plot(y, color='blue', linestyle='dashdot', linewidth=4, marker='o', markerfacecolor='red', markeredgecolor='black', markeredgewidth=3, markersize=12)
plt.savefig("controlWithKeyword.png")

####The png file of the code controlWithKeyword.png

##Change Ticks if You Want

#!/usr/bin/python
## changeTicks.py                                                           
import matplotlib.pyplot as plt
import numpy as np
x = [5, 3, 7, 2, 4, 1]
plt.plot(x)
plt.xticks(range(len(x)), ['a', 'b', 'c', 'd', 'e', 'f'])
plt.yticks(range(1, 8, 2))
plt.savefig("changeTicks.png")

####The png file of the code changeTicks.png