Knowledge Base

Takeaway Sheet: Preparing Presentations

1# Adding titles to graphs
2
3import matplotlib.pyplot as plt
4fig, test = plt.subplots()
5
6test.set_title('Title')

1# Adding labels to axes
2
3import matplotlib.pyplot as plt
4fig, test = plt.subplots()
5
6test.set_xlabel('Label for X axis')
7test.set_ylabel('Label for Y axis')

1# Adding legends to graphs
2
3import matplotlib.pyplot as plt
4fig, test = plt.subplots()
5
6test.plot(x, y1, label = 'Label 1')
7test.plot(x, y2, label = 'Label 2')
8test.plot(x, y3, label = 'Label 3')
9
10test.legend()

1# Changing graph dimensions
2
3import matplotlib.pyplot as plt
4fig, test = plt.subplots()
5
6fig.set_figheight(10) # changing the height
7fig.set_figwidth(8) # changing the width
Send Feedback
close
  • Bug
  • Improvement
  • Feature
Send Feedback
,