Adding some style

Introduction to Data Science in Python

Hillary Green-Lerman

Senior Curriculum Lead, DataCamp

And miles to go

police-car.png

driving-graph.png

Introduction to Data Science in Python

Changing line color

plt.plot(x, y1, color="tomato")
plt.plot(x, y2, color="orange")
plt.plot(x, y3, color="goldenrod")
plt.plot(x, y4, color="seagreen")
plt.plot(x, y5, color="dodgerblue")
plt.plot(x, y6, color="violet")

Introduction to Data Science in Python

Changing line width

plt.plot(x, y1, linewidth=1)
plt.plot(x, y2, linewidth=2)
plt.plot(x, y3, linewidth=3)
plt.plot(x, y4, linewidth=4)
plt.plot(x, y5, linewidth=5)
plt.plot(x, y6, linewidth=6)
plt.plot(x, y7, linewidth=7)

Introduction to Data Science in Python

Changing line style

plt.plot(x, y1, linestyle='-')
plt.plot(x, y2, linestyle='--')
plt.plot(x, y3, linestyle='-.')
plt.plot(x, y4, linestyle=':')

Introduction to Data Science in Python

Adding markers

plt.plot(x, y1, marker='x')
plt.plot(x, y2, marker='s')
plt.plot(x, y3, marker='o')
plt.plot(x, y4, marker='d')
plt.plot(x, y5, marker='*')
plt.plot(x, y6, marker='h')

Introduction to Data Science in Python

Setting a style

Before any other plotting code:

plt.style.use('fivethirtyeight')
plt.style.use('ggplot')
plt.style.use('seaborn')
plt.style.use('default')

Introduction to Data Science in Python

Let's practice!

Introduction to Data Science in Python

Preparing Video For Download...