Python 数据可视化 散点图
import matplotlib. pyplot as plt
import numpy as np
def plot_scatter ( ref_info_dict, test_info_dict) :
plt. figure( figsize= ( 80 , 48 ) )
n = 0
scatter_header_list = list ( ref_info_dict. keys( ) )
for header in scatter_header_list:
n += 1
plt. subplot( 8 , 10 , n)
x = np. array( ref_info_dict[ header] )
y = np. array( test_info_dict[ header] )
max_line = max ( [ max ( x) , max ( y) ] )
min_line = min ( [ min ( x) , min ( y) ] )
plt. scatter( x,
y,
c= 'red' ,
label= 'function' )
plt. plot( [ min_line, max_line] , [ min_line, max_line] , ls= "--" , c= ".3" )
plt. title( header)
plt. xlabel( "old data" )
plt. ylabel( "new data" )
plt. legend( )
plt. show( )
plt. savefig( 'tmp_scatter.jpg' )