% matplotlib notebook
import matplotlib. pyplot as plt
import numpy as np
data= np. arange( 10 )
fig= plt. figure( )
plt. plot( data)
plt. show( )
<IPython.core.display.Javascript object>
import matplotlib. pyplot as plt
fig= plt. figure( )
ax1= fig. add_subplot( 2 , 2 , 1 )
ax1= fig. add_subplot( 2 , 2 , 2 )
ax1= fig. add_subplot( 2 , 2 , 3 )
plt. show( )
<IPython.core.display.Javascript object>
import matplotlib. pyplot as plt
fig= plt. figure( )
plt. rcParams[ 'font.family' ] = [ 'SimHei' ]
plt. rcParams[ 'axes.unicode_minus' ] = False
data= np. arange( 0 , 10 , 0.01 )
ax1= fig. add_subplot( 2 , 3 , 1 )
plt. xlabel( 'X' )
plt. ylabel( 'Y' )
plt. xlim( 0 , 1 )
plt. title( '图1' )
plt. savefig( '图1.png' )
ax2= fig. add_subplot( 2 , 3 , 2 )
plt. title( 'test' )
ax3= fig. add_subplot( 2 , 3 , 3 )
ax1. plot( [ 1 , - 2 , 3 , - 4 ] )
ax2. plot( data)
ax3. plot( data, np. sin( data) )
ax3. plot( data, np. cos( data) )
plt. title( '测试图' )
plt. xlabel( 'X' )
plt. xlim( 0 , np. pi* 2 )
plt. xticks( [ 0 , np. pi/ 2 , np. pi* 3 / 2 , np. pi* 2 ] )
plt. legend( [ 'sinx' , 'cosx' ] )
plt. savefig( '可视化测试.png' )
plt. show( )
<IPython.core.display.Javascript object>
import matplotlib. pyplot as plt
fig= plt. figure( )
data= np. arange( 0 , 100 , 0.01 )
ax1= fig. add_subplot( 2 , 3 , 1 )
ax2= fig. add_subplot( 2 , 3 , 2 )
ax3= fig. add_subplot( 2 , 3 , 3 )
ax1. plot( [ 1 , 8 , 8 , - 8 ] )
ax2. plot( [ - 5 , 5 , 5 , 9 ] )
ax3. plot( data, np. cos( data) )
plt. show( )
<IPython.core.display.Javascript object>