October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following code block plots 11 different ways a legend can be specified:
plt.figure(figsize=(15, 10))
plt.subplot(3,4,1)line, = plt.plot([1, 2, 3], label='Inline label')plt.legend()
plt.subplot(3,4,2)line, = plt.plot([1, 2, 3])line.set_label('Label via method')plt.legend()
plt.subplot(3,4,3)plt.plot([1, 2, 3])plt.plot([3, 2, 1])plt.legend(['Positive Slope', 'Negative Slope'])plt.title('List of Labels')
plt.subplot(3,4,4) ...
Read now
Unlock full access