Common Settings for Charts
1. Add text labels
matplotlib.pyplot.text(x,y,s,**kwargs)
General Drawing Parameters |
illustrate |
fontsize |
font size |
ha |
horizontal alignment |
va |
vertical alignment |
for a,b in zip(x,y):
plt.text(a,b,b,ha="center",va="center",fontsize=12,color="y")
2. Set the title (the title of the entire chart) and the legend
matplotlib.pyplot.title()
matplotlib.pyplot.lengend()
Location |
illustrate |
best |
adaptive |
upper right |
upper right |
upper left |
upper left |
lower right |
bottom right |
lower left |
lower left |
right |
Right |
center left |
middle left |
center right |
middle right |
upper center |
upper middle |
center |
center |
lower center |
lower middle |
plt.title( " scatter plot " , fontsize = 20 ) #add title
plt.legend( "MAX" , fontsize = 12 ) #add legend
Pay attention to the problem of Chinese garbled characters, the solution has been published in the previous article.