import matplotlib.pyplot as plt

plt.scatter([1,2,3,4],[2,3,2,5])
plt.title('My first plot')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-2*np.pi,2*np.pi,0.1)
y = np.sin(x)
y1 = np.sin(x+np.pi/2)
y2 = np.sin(x+np.pi/3)
plt.scatter(x,y,marker='s',color='yellow')
plt.scatter(x,y1,marker='^',color='green')
plt.scatter(x,y2,marker='*',color='red')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-2*np.pi,2*np.pi,0.1)
y = np.sin(x)
y1 = np.sin(x+np.pi/2)
y2 = np.sin(x+np.pi/3)
plt.plot(x,y)
plt.plot(x,y1,'-.')
plt.plot(x,y2,'--')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.array([3,5,6,7,8,12])
y = np.array([3,2,5,8,3,12])
plt.plot(x,y)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-4*np.pi,4*np.pi,0.1)
y = np.sin(x)
plt.subplot(211)
plt.plot(x,y,'-.')
plt.subplot(212)
plt.plot(x,y,'--',color='red')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-4*np.pi,4*np.pi,0.1)
y = np.sin(x)
plt.subplot(121)
plt.plot(x,y,'-.')
plt.subplot(122)
plt.plot(x,y,'--',color='r')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.array([2,5,7,9])
y = np.array([1,3,6,4])
plt.scatter(x,y)
plt.title('My First Plot')
plt.xlabel('X Label')
plt.ylabel('Y Label')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.array([2,4,6,9])
y = np.array([1,5,3,7])
plt.scatter(x,y)
plt.title('My first plot',fontsize=25)
plt.xlabel('X Label',fontsize=20,color='gray')
plt.ylabel('Y Label',fontsize=20,color='gray')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.array([2,4,6,8])
y = np.array([3,6,4,3])
plt.scatter(x,y)
plt.text(2+0.2,3,'first')
plt.text(4+0.2,6,'second')
plt.text(6+0.2,4,'thirst')
plt.text(8+0.2,3,'fourth')
plt.title('My first plot',fontsize=20)
plt.xlabel('X Label',fontsize=15,color='gray')
plt.ylabel('Y Label',fontsize=15,color='gray')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.array([1,3,5,8])
y = np.array([2,5,3,7])
plt.scatter(x,y)
plt.text(1.2,2,'first')
plt.text(3.2,5,'second')
plt.text(5.2,3,'third')
plt.text(7,7,'fourth')
plt.title('My first plot',fontsize=20)
plt.xlabel('X Label',fontsize=15,color='gray')
plt.ylabel('Y Label',fontsize=15,color='gray')
plt.text(7,5,r'$y=x^2$',fontsize=15,bbox={'facecolor':'yellow','alpha':0.5})
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.array([1,3,4,7])
y = np.array([4,5,2,8])
plt.scatter(x,y)
plt.text(1.2,4,'first')
plt.text(3.2,5,'second')
plt.text(4.5,2,'third')
plt.text(6.3,8,'fourth')
plt.text(6,5,r'$y=x^2$',fontsize=18,bbox={'facecolor':'green','alpha':0.5})
plt.title('My first plot',fontsize=20)
plt.xlabel('X Label',fontsize=15,color='gray')
plt.ylabel('Y Label',fontsize=15,color='gray')
plt.grid(True)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.array([2,4,6,8])
y = np.array([3,7,5,2])
plt.scatter(x,y,color='red')
plt.text(2.2,3,'first')
plt.text(4.2,7,'scend')
plt.text(6.2,5,'third')
plt.text(7,2,'fourth')
plt.text(5,4,r'$y=x^2$',fontsize=18,bbox={'facecolor':'blue','alpha':0.5})
plt.title('My first plot',fontsize=20)
plt.xlabel('X Label',fontsize=15,color='green')
plt.ylabel('Y Label',fontsize=15,color='yellow')
plt.legend(['first legend'],loc=6)
plt.grid(True)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.array([1,3,5,7])
y = np.array([3,8,6,3])
y1 = np.array([3.2,8.2,6.2,3.2])
y2 = np.array([3.5,8.5,6.5,3.5])
plt.scatter(x,y,color='red',marker='*')
plt.scatter(x,y1,color='green',marker='s')
plt.scatter(x,y2,color='yellow',marker='^')
plt.text(1,3.8,'first')
plt.text(3,8.8,'second')
plt.text(5,6.8,'third')
plt.text(7,3.8,'fourth')
plt.text(3,5,r'$y=x^2$',fontsize=20,bbox={'facecolor':'blue','alpha':0.5})
plt.title('My first plot',fontsize=20)
plt.xlabel('X Label',fontsize=15,color='blue')
plt.ylabel('Y Label',fontsize=15,color='gray')
plt.legend(['red','green','yellow'],loc=2)
plt.grid(True)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import datetime
from mpl_toolkits.mplot3d import Axes3D

x = [datetime.date(2015,1,23),datetime.date(2015,1,27),
datetime.date(2015,2,14),datetime.date(2015,2,20),
datetime.date(2015,3,15),datetime.date(2015,3,27),
datetime.date(2015,4,9),datetime.date(2015,4,26)]
y = [23,27,14,20,15,27,9,26]
plt.plot(x,y)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import datetime
import matplotlib.dates as mdates
from mpl_toolkits.mplot3d import Axes3D

x = [datetime.date(2015,1,23),datetime.date(2015,1,27),
datetime.date(2015,2,14),datetime.date(2015,2,20),
datetime.date(2015,3,15),datetime.date(2015,3,27),
datetime.date(2015,4,9),datetime.date(2015,4,26)]
y = [23,27,14,20,15,27,9,26]
months = mdates.MonthLocator()
days = mdates.DayLocator()
timeFmt = mdates.DateFormatter('%Y-%m')
fig,ax = plt.subplots()
ax.xaxis.set_major_locator(months)
ax.xaxis.set_major_formatter(timeFmt)
ax.xaxis.set_minor_locator(days)
plt.plot(x,y)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-2*np.pi,2*np.pi,0.01)
y = np.sin(3*x)/x
plt.plot(x,y)
plt.show()

import numpy as np
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-2*np.pi,2*np.pi,0.01)
y = np.sin(3*x)/x
y1 = np.sin(2*x)/x
y2 = np.sin(x)/x
plt.plot(x,y)
plt.plot(x,y1)
plt.plot(x,y2)
plt.show()

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(-2*np.pi,2*np.pi,0.01)
y = np.sin(3*x)/x
y1 = np.sin(2*x)/x
y2 = np.sin(x)/x
plt.plot(x,y,'*',color='green')
plt.plot(x,y1,'-.',color='blue')
plt.plot(x,y2,'k--')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.arange(-2*np.pi,2*np.pi,0.01)
y = np.sin(3*x)/x
y1 = np.sin(2*x)/x
y2 = np.sin(x)/x
plt.plot(x,y,color='red')
plt.plot(x,y1,color='green')
plt.plot(x,y2,color='blue')
plt.xticks([-2*np.pi,-np.pi,0,np.pi,2*np.pi],[r'$-2\pi$',r'$-\pi$',r'$0$',r'$+\pi$',r'$+2\pi$'])
plt.yticks([-1,0,+1,+2,+3],[r'$-1$',r'$0$',r'$+1$',r'$+2$',r'$+3$'])
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.arange(-2*np.pi,2*np.pi,0.01)
y = np.sin(3*x)/x
y1 = np.sin(2*x)/x
y2 = np.sin(x)/x
plt.plot(x,y,color='green')
plt.plot(x,y1,color='red')
plt.plot(x,y2,color='blue')
plt.xticks([-2*np.pi,-np.pi,0,np.pi,2*np.pi],[r'$-2\pi$',r'$-\pi$',r'$0$',r'$+\pi$',r'$+2\pi$'])
plt.yticks([-1,0,1,2,3],[r'$-1$',r'$0$',r'$+1$',r'$+2$'])
ax = plt.gca()
ax.spines['top'].set_color('none')
ax.spines['right'].set_color('none')
ax.spines['bottom'].set_position(('data',0))
ax.spines['left'].set_position(('data',0))
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.arange(-2*np.pi,2*np.pi,0.01)
y = np.sin(3*x)/x
y1 = np.sin(2*x)/x
y2 = np.sin(x)/x
plt.plot(x,y,color='red',linewidth=1)
plt.plot(x,y1,color='green',linewidth=2)
plt.plot(x,y2,color='blue',linewidth=3)
plt.xticks([-2*np.pi,-np.pi,0,np.pi,2*np.pi],[r'$-2\pi$',r'$-\pi$',r'$0$',r'$+\pi$',r'$+2\pi$'])
plt.yticks([-1,0,1,2,3],[r'$-1$',r'$0$',r'$+1$',r'$+2$',r'$+3$'])
ax = plt.gca()
ax.spines['top'].set_color('none')
ax.spines['right'].set_color('none')
ax.spines['bottom'].set_position(('data',0))
ax.spines['left'].set_position(('data',0))
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.arange(-2*np.pi,2*np.pi,0.01)
y = np.sin(3*x)/x
y1 = np.sin(2*x)/x
y2 = np.sin(x)/x
plt.plot(x,y,color='red')
plt.plot(x,y1,color='green')
plt.plot(x,y2,color='blue')
plt.xticks([-2*np.pi,-np.pi,0,np.pi,2*np.pi],[r'$-2\pi$',r'$-\pi$',r'$0$',r'$+\pi$',r'$+2\pi$'])
plt.yticks([-1,0,1,2,3],[r'$-1$',r'$0$',r'$+1$',r'$+2$',r'$+3$'])
ax = plt.gca()
ax.spines['top'].set_color('none')
ax.spines['right'].set_color('none')
ax.spines['bottom'].set_position(('data',0))
ax.spines['left'].set_position(('data',0))
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
plt.annotate(r'$\lim_{x\to 0}\frac{\sin(x)}{x}=1$',xytext=[np.pi,2],xy=[0,1],
fontsize=15,arrowprops={'arrowstyle':'->','connectionstyle':'arc3,rad=0.2'})
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x1 = np.random.randint(0,10,10)
x2 = np.random.randint(0,10,10)
x3 = np.random.randint(0,10,10)
data = {'series1':x1,
'series2':x2,
'series3':x3}
x = np.arange(10)
df = pd.DataFrame(data)
plt.plot(x,df)
plt.legend(data,loc=9)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

data = np.random.randint(0,100,100)
plt.hist(data,bins=20)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5])
y = np.array([7,4,2,6,9])
plt.bar(x,y)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5])
y = np.array([7,4,2,6,9])
plt.bar(x,y)
plt.xticks(x+0.4,['A','B','C','D','E'])
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5])
y = np.array([3,7,4,5,9])
err = np.array([0.1,0.2,0.3,0.4,0.5])
plt.bar(x,y,yerr=err,error_kw={'ecolor':'0.6','capsize':6},color='green',alpha=0.5)
plt.legend(['First'],loc=2)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5])
y = np.array([3,5,2,7,4])
err = np.array([1,2,3,4,5])
plt.barh(x,y,xerr=err,error_kw={'ecolor':'0.3','capsize':6},color='yellow')
plt.legend(['First'],loc=4)
plt.title('First',fontsize=20)
plt.yticks(x+0.4,['A','B','C','D','E'])
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

b=0.3
x = np.array([1,2,3,4,5])
y = np.array([1,2,3,4,5])
y1 = np.array([5,3,6,8,3])
y2 = np.array([5,6,2,5,9])
plt.bar(x,y,b,color='red')
plt.bar(x+b,y1,b,color='green')
plt.bar(x+2*b,y2,b,color='blue')
plt.xticks(x+0.5,['A','B','C','D','E'])
plt.title('First',color='yellow',fontsize=20)
plt.grid(True)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

bw=0.3
x = np.array([1,2,3,4,5])
y = np.array([1,2,3,4,5])
y1 = np.array([3,2,6,7,4])
y2 = np.array([5,3,1,6,7])
plt.barh(x,y,bw,color='red')
plt.barh(x+bw,y1,bw,color='green')
plt.barh(x+2*bw,y2,bw,color='blue')
plt.yticks(x+0.5,['A','B','C','D','E'])
plt.title('First',fontsize=20)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x1 = np.random.randint(0,10,10)
x2 = np.random.randint(0,10,10)
x3 = np.random.randint(0,10,10)
data = {'series1':x1,
'series2':x2,
'series3':x3}
df = pd.DataFrame(data)
df.plot(kind='bar')
plt.grid(True)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x1 = np.random.randint(0,10,10)
x2 = np.random.randint(0,10,10)
x3 = np.random.randint(0,10,10)
data = {'series1':x1,
'series2':x2,
'series3':x3}
df = pd.DataFrame(data)
df.plot(kind='barh')
plt.grid(True)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5])
y = np.array([1,4,3,2,2])
y1 = np.array([3,2,1,4,2])
y2 = np.array([1,4,2,3,3])
plt.bar(x,y,color='red')
plt.bar(x,y1,bottom=y,color='green')
plt.bar(x,y2,bottom=y+y1,color='blue')
plt.xticks(x+0.4,['A','B','C','D','E'])
plt.grid(True)
plt.title('First',color='yellow',fontsize=25)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5])
y = np.array([1,2,3,4,5])
y1 = np.array([1,2,3,4,5])
y2 = np.array([1,2,3,4,5])
plt.barh(x,y,color='red')
plt.barh(x,y1,left=y,color='green')
plt.barh(x,y2,left=y1+y,color='blue')
plt.yticks(x+0.4,['A','B','C','D','E'])
plt.grid(True)
plt.legend(['A','B','C'],loc=5)
plt.title('First',fontsize=25,color='yellow')
plt.xlabel('X Lable',fontsize=15)
plt.ylabel('Y Lable',fontsize=15)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5])
y = np.array([1,2,3,4,5])
y1 = np.array([1,2,3,4,5])
y2 = np.array([1,2,3,4,5])
plt.barh(x,y,color='red',hatch='xx')
plt.barh(x,y1,left=y,color='green',hatch='\\')
plt.barh(x,y2,left=y1+y,color='blue',hatch='//')
plt.yticks(x+0.4,['A','B','C','D','E'])
plt.legend(['red','green','blue'],loc=4)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x1 = np.array([1,2,3,4,5])
x2 = np.array([1,2,3,4,5])
x3 = np.array([1,2,3,4,5])
x4 = np.array([1,2,3,4,5])
data = {'series1':x1,
'series2':x2,
'series3':x3,
'series4':x4}
df = pd.DataFrame(data)
df.plot(kind='bar',stacked=True)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5,6,7,8])
y = np.array([1,2,3,4,5,6,7,8])
plt.bar(x,y,edgecolor='yellow')
plt.bar(x,-y,facecolor='red',edgecolor='w')
plt.xticks(())
for i,j in zip(x,y):
plt.text(i+0.3,j+0.3,'%d' % j)
for i,j in zip(x,y):
plt.text(i+0.3,-j-0.9,'%d' % j)
plt.yticks(np.arange(-10,11))
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

value = np.random.randint(1,10,5)
labels = ['First','Second','Third','Fourth','Firth']
colors = ['red','green','blue','yellow','black']
plt.pie(value,labels=labels,colors=colors)
plt.axis('equal')
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

value = np.random.randint(1,10,10)
labels = ['one','two','three','four','five','six','secen','eight','nice','tex']
explode = [0,0,0,0.3,0,0,0,0,0,0]
plt.pie(value,labels=labels,explode=explode,startangle=90)
plt.axis('equal')
plt.title('A pie',fontsize=25)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

value = np.random.randint(1,10,10)
labels = ['one','two','three','four','five','six','seven','eight','nice','ten']
explode = [0,0,0,0,0,0,0.2,0,0,0]
plt.pie(value,labels=labels,explode=explode,shadow=True,startangle=90,autopct='%1.1f%%')
plt.axis('equal')
plt.title('A pie',fontsize=25)
plt.show()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

x1 = np.random.randint(1,10,10)
x2 = np.random.randint(1,10,10)
x3 = np.random.randint(1,10,10)
x4 = np.random.randint(1,10,10)
data = {'series1':x1,
'series2':x2,
'series3':x3,
'series4':x4}
df = pd.DataFrame(data)
df['series1'].plot(kind='pie',figsize=(6,6))
plt.show()

import numpy as np
import matplotlib.pyplot as plt

dx = 0.01
dy = 0.01
x = np.arange(-2.0,2.0,dx)
y = np.arange(-2.0,2.0,dy)
X,Y = np.meshgrid(x,y)
def f(x,y):
return (1-y**5+x**5)*np.exp(-x**2-y**2)
C = plt.contour(X,Y,f(X,Y),20,color='black')
plt.contourf(X,Y,f(X,Y),20)
plt.clabel(C,inline=1,fontsize=10)
plt.show()

import numpy as np
import matplotlib.pyplot as plt

dx = 0.01
dy = 0.01
x = np.arange(-2.0,2.0,dx)
y = np.arange(-2.0,2.0,dy)
X,Y = np.meshgrid(x,y)
def f(x,y):
return (1-y**5+x**5)*np.exp(-x**2-y**2)
C = plt.contour(X,Y,f(X,Y),20,color='black')
plt.contourf(X,Y,f(X,Y),20)
plt.clabel(C,inline=1,fontsize=12)
plt.colorbar()
plt.show()

import numpy as np
import matplotlib.pyplot as plt

N = 8
x = np.arange(0.0,2*np.pi,2*np.pi/N)
y = np.array([1,2,3,4,5,6,7,8])
plt.axes([0.025,0.025,0.95,0.95],polar=True)
color = ['red','green','blue','yellow']
plt.bar(x,y,color=color,width=(2*np.pi/N))
plt.show()

import numpy as np
import matplotlib.pyplot as plt

N = 8
x = np.arange(0.0,2*np.pi,2*np.pi/N)
y = np.array([1,2,3,4,5,6,7,8])
plt.axes([0.025,0.025,0.95,0.95],polar=True)
color=['red','green','blue','yellow']
plt.bar(x,y,color=color,width=(2*np.pi/N),bottom=0.5,label=['te','te','te','te','te'])
plt.show()

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-2,2,0.01)
y = np.arange(-2,2,0.01)
X,Y = np.meshgrid(x,y)
def f(x,y):
return (1-y**5+x**5)*np.exp(-x**2-y**2)
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(X,Y,f(X,Y),cstride=10,rstride=10)
plt.show()

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-3,3,0.01)
y = np.arange(-3,3,0.01)
X,Y = np.meshgrid(x,y)
def f(x,y):
return (1-y**5+x**5)*np.exp(-x**2-y**2)
C = plt.contour(X,Y,f(X,Y),20,color='black')
plt.contourf(X,Y,f(X,Y),20)
plt.clabel(C,inline=1,fontsize=10)
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(X,Y,f(X,Y),rstride=10,cstride=10,cmap=plt.cm.CMRmap_r)
ax.view_init(elev=30,azim=125)
plt.show()

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x1 = np.random.randint(30,40,100)
x2 = np.random.randint(20,30,100)
x3 = np.random.randint(10,20,100)
y1 = np.random.randint(50,60,100)
y2 = np.random.randint(30,40,100)
y3 = np.random.randint(50,70,100)
z1 = np.random.randint(10,30,100)
z2 = np.random.randint(40,50,100)
z3 = np.random.randint(40,50,100)

fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(x1,y1,z1)
ax.scatter(x2,y2,z2,color='red',marker='^')
ax.scatter(x3,y3,z3,color='green',marker='s')
plt.show()

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(8)
y = np.random.randint(0,10,8)
y1 = y+np.random.randint(0,3,8)
y2 = y1+np.random.randint(0,3,8)
y3 = y2+np.random.randint(0,3,8)
y4 = y3+np.random.randint(0,3,8)
y5 = y4+np.random.randint(0,3,8)

color = ['red','green','blue','yellow']
fig = plt.figure()
ax = Axes3D(fig)
ax.bar(x,y,0,zdir='y',color=color)
ax.bar(x,y1,10,zdir='y',color=color)
ax.bar(x,y2,20,zdir='y',color=color)
ax.bar(x,y3,30,zdir='y',color=color)
ax.bar(x,y4,40,zdir='y',color=color)
ax.bar(x,y5,50,zdir='y',color=color)
ax.view_init(elev=40,azim=30)
plt.show()

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8])
innerAx = fig.add_axes([0.6,0.6,0.25,0.25])
plt.show()

import numpy as np
import matplotlib.pyplot as plt

x = np.random.randint(1,20,30)
y = np.random.randint(1,20,30)
fig = plt.figure()
ax1 = fig.add_axes([0.1,0.1,0.8,0.8])
ax2 = fig.add_axes([0.6,0.6,0.25,0.25])
ax1.plot(x,y,color='red')
ax1.scatter(x,y,color='blue')
ax2.plot(x,y,color='yellow')
ax2.scatter(x,y,color='green')
plt.show()

import numpy as np
import matplotlib.pyplot as plt

gs = plt.GridSpec(3,3)
fig = plt.figure(figsize=(6,6))
fig.add_subplot(gs[2,0])
fig.add_subplot(gs[2,1:])
fig.add_subplot(gs[1,:2])
fig.add_subplot(gs[0,:2])
fig.add_subplot(gs[0:2,2])
plt.show()

import numpy as np
import matplotlib.pyplot as plt

x = np.random.randint(1,20,10)
y = np.random.randint(1,20,10)
gs = plt.GridSpec(3,3)
fig = plt.figure(figsize=(6,6))
t1 = fig.add_subplot(gs[2,0])
t2 = fig.add_subplot(gs[2,1:])
t3 = fig.add_subplot(gs[1,:2])
t4 = fig.add_subplot(gs[0,:2])
t5 = fig.add_subplot(gs[:2,2])
t1.plot(x,y,color='red')
t2.scatter(x,y,color='green',marker='^')
t2.scatter([1,2,3,4],[4,3,2,1],marker='s')
t3.bar(x,y,color=['yellow','blue'])
t4.barh(x,y,color=['green','red'])
t5.plot(x,y,color='green')
plt.show()

吴裕雄 python matplotlib 绘图示例的更多相关文章

  1. Python Matplotlib绘图基础

    Matplotlib绘图基础 1.Figure和Subplot import numpy as np import matplotlib.pyplot as plt #创建一个Figure fig = ...

  2. python matplotlib 绘图基础

    在利用Python做数据分析时,探索数据以及结果展现上图表的应用是不可或缺的. 在Python中通常情况下都是用matplotlib模块进行图表制作. 先理下,matplotlib的结构原理: mat ...

  3. Python matplotlib绘图学习笔记

    测试环境: Jupyter QtConsole 4.2.1Python 3.6.1 1.  基本画线: 以下得出红蓝绿三色的点 import numpy as npimport matplotlib. ...

  4. 吴裕雄 python 机器学习——分类决策树模型

    import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.model_s ...

  5. 吴裕雄 python 机器学习——回归决策树模型

    import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.model_s ...

  6. 吴裕雄 python 机器学习——线性判断分析LinearDiscriminantAnalysis

    import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot ...

  7. 吴裕雄 python 机器学习——逻辑回归

    import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot ...

  8. 吴裕雄 python 机器学习——ElasticNet回归

    import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot ...

  9. 吴裕雄 python 机器学习——Lasso回归

    import numpy as np import matplotlib.pyplot as plt from sklearn import datasets, linear_model from s ...

随机推荐

  1. C语言字符串定义(数组&指针)

    /***************************************************************************** * @brief : 字符串定义方法总结 ...

  2. 新手尝试Android studio连接mumu调试程序

    由于Android studio本身虚拟机比较卡在安装as的时候就没有安装.于是自己安装了一款手机模拟器mumu模拟器.我想真机可以调试那么摸仪器应该也可以,于是就从网上找资料,其实连接很简单. 1. ...

  3. Azure CosmosDB (8) 性能指标Request Unit-RU

    <Windows Azure Platform 系列文章目录> 本次将介绍Cosmos DB的性能指标RU (Request Unit). 总的来说,我们设置的Azure CosmosDB ...

  4. M25P16中文版

    转载:https://blog.csdn.net/weiweiliulu/article/details/23666717 1.M25P16概述     M25P16是一款带有先进写保护机制和高速SP ...

  5. Hbase的集群安装

    hadoop集群的搭建 搭建真正的zookeeper集群 Hbase需要安装在成功部署的Hadoop平台,并且要求Hadoop已经正常启动. 同时,HBase需要集群部署,我们分别把HBase 部署到 ...

  6. Python通过百度Ai识别图片中的文字

    版本:python3.7 工作中有需要识别图片中的汗字,查看了半天大神们的博客,但没找到完全可以用的源码,经过自己的实践,以下源码可以实现: 创建应用 首先你需要登录百度AI,选择文字识别,创建一个应 ...

  7. pandas学习笔记(一)

    Pandas是一款开放源码的BSD许可的Python库,为Python编程语言提供了高性能,易于使用的数据结构和数据分析工具.Pandas用于广泛的领域,包括金融,经济,统计,分析等学术和商业领域.在 ...

  8. html 5 dialog标签:定义特殊术语或短语

    html5中<dialog>标签作用是定义特殊术语或短语,这里主机吧详细介绍下<dialog>标签用法.<dialog>标签属性以及<dialog>标签 ...

  9. 思维导图工具XMind下载

    XMind 是一款非常实用的商业思维导图软件,全力打造易用.高效的可视化思维软件,强调软件的可扩展.跨平台.稳定性和性能,致力于使用先进的软件技术帮助用户真正意义上提高生产率.XMind 支持 在Wi ...

  10. java类的生命周期

    https://www.cnblogs.com/aspirant/p/7200523.html 验证的内容:文件格式,字节码,符号引用,元数据 准备:给静态变量分配内存设置初始值(0) 初始化才是真正 ...