随笔分类 - plt
摘要:import matplotlib.pyplot as plt import numpy as np x = np.arange(0,10,0.1) y1 = 0.05*x**2 y2 = -1*y1 fig,ax1 = plt.subplots() ax2 = ax1.twinx() ax1.pl
阅读全文
摘要:import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec fig = plt.figure() x = [1,2,3,4,5,6,7] y = [1,3,4,5,6,8,6] left,bottom,width,he
阅读全文
摘要:import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec #method 1 plt.figure() ax1 = plt.subplot2grid((3,3),(0,0),colspan=3,rowspan=1)
阅读全文
摘要:import matplotlib.pyplot as plt plt.figure() plt.subplot(2,1,1) plt.plot([0,1],[0,1]) plt.subplot(2,3,4) plt.plot([0,1],[0,2]) plt.subplot(2,3,5) plt.
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = Axes3D(fig) X = np.arange(-4,4,0.25
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np #image data a = np.array([0.31366,0.36534,0.42373, 0.36534,0.43959,0.53444, 0.42333,0.52555,0.65566
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np def f(x,y): #the height function return (1 - x/2 + x**5 + y**3)*np.exp(-x**2-y**2) n=256 x=np.linsp
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np n=12 X=np.arange(n) Y1=(1-X/float(n))*np.random.uniform(0.5,1.0,n) Y2=(1-X/float(n))*np.random.unif
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np n=1024 X = np.random.normal(0,1,n) Y = np.random.normal(0,1,n) T = np.arctan2(Y,X)#for color value
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np x = np.linspace(-3,3,50) y = 0.1*x plt.figure() #范围 plt.xlim((-4,4)) plt.ylim((-5,5)) plt.xlabel('X
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np x = np.linspace(-3,3,50) y = 2*x+1 plt.figure() #范围 plt.xlim((-3,4)) plt.ylim((-3,6)) #轴含义(标签) plt.
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np x = np.linspace(-1,1,50) y1 = 2*x+1 y2 = x**2 plt.figure() #范围 plt.xlim((-1,2)) plt.ylim((-2,3)) #轴
阅读全文
摘要:```pythonimport matplotlib.pyplot as pltimport numpy as np x = np.linspace(-1,1,50)y1 = 2*x+1y2 = x**2 plt.figure()plt.plot(x,y2)plt.plot(x,y1,color='
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np x = np.linspace(-1,1,50) y1 = 2*x+1 y2 = x**2 plt.figure() plt.plot(x,y2) plt.plot(x,y1,color='red'
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np x = np.linspace(-1,1,50) y1 = 2*x+1 y2 = x**2 plt.figure(num=1,figsize=(10,10)) plt.plot(x,y1) plt.
阅读全文
摘要:import matplotlib.pyplot as plt import numpy as np x = np.linspace(-1,1,50) #y = 2*x+1 y = x**2 plt.plot(x,y) plt.show()
阅读全文