December 19, 2019

Data Visualization

When we have multiple lines on a single graph, we can label them by using the command
plt.legend()

plt.legend() can also take a keyword argument loc, which will position the legend on the figure
loc=6 (0-10) default is 0, which may be considered the best

Modify tick marks

Because our plots can have multiple subplots, we have to specify which one we want to modify.
ax = plt.subplot()

Now we can modify the ticks for that subplot
ax.set_xticks([1,2,5])
ax.set_yticks([0.1, 0.2, 0.3])

ax.set_yticklabels([‘10%, ‘20%’, ‘30%’])

Previous
Previous

December 20, 2019

Next
Next

December 17, 2019