Graphing Matplotlib Python Part 3: Colors and Line Thickness

How to do some basic Matplotlib customization

Once you've got the basics down, you'll probably want to learn how to customize the charts a bit. By default, the Matplotlib charts are rather bland, but the creator of Matplotlib left the door wide open to customization. In this tutorial, we'll just do a simple change of color to the line, as well as adjust the thickness of the line.

These are just two extremely basic customization options, there are many more for us to cover.

import matplotlib.pyplot as plt

x = []
y = []

fig = plt.figure()
rect = fig.patch

readFile = open('SampleData.txt','r')
sepFile ='\n')

for plotPair in sepFile:
    xAndY = plotPair.split(',')

ax1 = fig.add_subplot(1,1,1, axisbg='grey')
ax1.plot(x, y, 'c', linewidth=3.3)   

Fore more tutorials, head to the