This example describes the drawing of Python. Share to everyone for your reference, as follows:
1. Add data labels to graphics
Plt.plot (Datat.index,datat) Plt.xlabel (' index ', fontsize=15) plt.legend ([' T_bottom ', ' t_top '],loc = ' upper_right ', FontSize = ten) plt.show ()
2. Place the label on the far right
Plt.legend (bbox_to_anchor= (1.05, 1), loc=2, Borderaxespad=0.)
3, Display Chinese fonts appear box
# Coding:utf-8import Matplotlib.pyplot as pltplt.rcparams[' Font.sans-serif ']=[' Simhei '] #用来正常显示中文标签plt. rcParams[' Axes.unicode_minus ']=false #用来正常显示负号 # There are cases in Chinese that require U ' content
4, draw the Heat force diagram
Import pandas as Pdimport NumPy as Npimport Matplotlib.pyplot as Pltimport Seaborn as SNSD ={' 1 ': [0.87,0.95], ' 2 ': [0.86,0.9 1], ' 3 ': [0.86,0.93], ' 4 ': [0.86,0.92], ' 5 ': [0.86,0.93]}DF = PD. DataFrame (D,index = [2,1]) df### Annot is the value that represents the display square. CMap color Sns.heatmap (df,annot = true,cmap= "Ylgnbu") plt.show ()
5, Draw scatter chart, and multiple graphs coincident together
Import Matplotlib.pyplot as Pltimport Seaborn as Snscolor = Sns.color_palette () sns.set_style (' Darkgrid ')%matplotlib inlineplt.rcparams[' Font.sans-serif ']=[' Simhei '] #用来正常显示中文标签plt. rcparams[' Axes.unicode_minus ']=false #用来正常显示负号 # There is a situation in Chinese, need u ' content ' Plt.figure (figsize=[9,6]) plt.plot (Datat.index,datat_.t_bottom,color = ' R ') Plt.plot (Datat.index, Datat_.t_top,color = ' C ') plt.scatter (datat.index,datat_.bottom,marker= '. ', c= ' G ') Plt.scatter (datat.index,datat_. Top,marker= '. ', c= ' B ') plt.legend ((' T_bottom ', ' t_top ', ' noise_bottom ', ' Noise_top '), loc = ' upper right ', fontsize=15) Plt.xlabel (' index ', fontsize=15) Plt.ylabel (U ' temperature ', fontsize=15) #plt. Legend ([' T_bottom ', ' t_top '],loc = ' upper_right ') , FontSize = ten) plt.show ()
6. Paint Color
color =
| character |
Color |
'b' |
Blue |
'g' |
Green |
'r' |
Red |
'c' |
Cyan |
'm' |
Magenta |
'y' |
Yellow |
'k' |
Black |
'w' |
White |
Related recommendations:
Drawing a custom graphic
CSS3 drawing all kinds of graphs
Draw graphics using the Turtle library in Python
Drawing of basic iOS graphics