Drawing of the Python graph

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.