Common settings for matplotlib charts (3)

●Set the network line: grid() function

plt.plot(x , color = "y" , linestyle = "--" ) 

plt.grid( color = "0.5" , linestyle = "-" , linewidth = "1.5" ) #Set grid lines

Common parameters grid(b, which, axis, color, linestyle, linewidth, **kwargs)

for example axis

plt.grid( axis = "y" ) # hide the grid lines of y

  1. add text label

Maplotlib.pyplot.text(x,y,s,**kwargs)

General Drawing Parameters

Parameter Description

fontsize

font size

ha

horizontal alignment

Va

vertical alignment

  1. Set title and legend

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

The middle

lower center

lower middle

Guess you like

Origin blog.csdn.net/m0_62064241/article/details/126582473