tricontour_smooth_user
Tricontour Smooth User使用 matplotlib.tri.UniformTriRefiner 在用户定义的三角形网格上演示高分辨率三角形。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970import matplotlib.tri as triimport matplotlib.pyplot as pltimport matplotlib.cm as cmimport numpy as np#-----------------------------------------------------------------------------# Analytical test function#-----------------------------------------------------------------------------...
trigradient_demo
Trigradient 演示使用 matplotlib.tri.CubicTriInterpolator 演示梯度计算。 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980from matplotlib.tri import ( Triangulation, UniformTriRefiner, CubicTriInterpolator)import matplotlib.pyplot as pltimport matplotlib.cm as cmimport numpy as np#-----------------------------------------------------------------------------# Electrical potential of a dipole#----------...
tripcolor_demo
Tripcolor Demo非结构化三角形网格的伪彩色图。 123import matplotlib.pyplot as pltimport matplotlib.tri as triimport numpy as np 在不指定三角形的情况下创建三角剖分会导致点的Delaunay三角剖分。 123456789101112131415161718192021# First create the x and y coordinates of the points.n_angles = 36n_radii = 8min_radius = 0.25radii = np.linspace(min_radius, 0.95, n_radii)angles = np.linspace(0, 2 * np.pi, n_angles, endpoint=False)angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)angles[:, 1::2] += np.pi / n_anglesx = (radii * np.cos(a...
triinterp_demo
Triinterp 演示从三角网格到四边形网格的插值。 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253import matplotlib.pyplot as pltimport matplotlib.tri as mtriimport numpy as np# Create triangulation.x = np.asarray([0, 1, 2, 3, 0.5, 1.5, 2.5, 1, 2, 1.5])y = np.asarray([0, 0, 0, 0, 1.0, 1.0, 1.0, 2, 2, 3.0])triangles = [[0, 1, 4], [1, 2, 5], [2, 3, 6], [1, 5, 4], [2, 6, 5], [4, 5, 7], [5, 6, 8], [5, 8, 7], [7, 8, 9]]triang = mtri.Triangulation(x, y, triang...
triplot_demo
Triplot Demo创建和绘制非结构化三角形网格。 123import matplotlib.pyplot as pltimport matplotlib.tri as triimport numpy as np 在不指定三角形的情况下创建三角剖分会导致点的Delaunay三角剖分。 1234567891011121314151617181920# First create the x and y coordinates of the points.n_angles = 36n_radii = 8min_radius = 0.25radii = np.linspace(min_radius, 0.95, n_radii)angles = np.linspace(0, 2 * np.pi, n_angles, endpoint=False)angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)angles[:, 1::2] += np.pi / n_anglesx = (radii * np.cos(angle...
watermark_image
图像水印使用PNG文件作为水印。 123456789101112131415161718192021import numpy as npimport matplotlib.cbook as cbookimport matplotlib.image as imageimport matplotlib.pyplot as plt# Fixing random state for reproducibilitynp.random.seed(19680801)datafile = cbook.get_sample_data('logo2.png', asfileobj=False)print('loading %s' % datafile)im = image.imread(datafile)im[:, :, -1] = 0.5 # set the alpha channelfig, ax = plt.subplots()ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=...
arctest
拉弧测试拉弧测试示例。 123456789101112131415161718import matplotlib.pyplot as pltimport numpy as npdef f(t): 'A damped exponential' s1 = np.cos(2 * np.pi * t) e1 = np.exp(-t) return s1 * e1t1 = np.arange(0.0, 5.0, .2)l = plt.plot(t1, f(t1), 'ro')plt.setp(l, markersize=30)plt.setp(l, markerfacecolor='C0')plt.show() 下载这个示例 下载python源码: arctest.py 下载Jupyter notebook: arctest.ipynb
broken_barh
破损条形图制作一个“破损”的水平条形图,即一个有间隙的条形图 ; 12345678910111213141516171819import matplotlib.pyplot as pltfig, ax = plt.subplots()ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='blue')ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9), facecolors=('red', 'yellow', 'green'))ax.set_ylim(5, 35)ax.set_xlim(0, 200)ax.set_xlabel('seconds since start')ax.set_yticks([15, 25])ax.set_yticklabels(['Bill', 'Jim'])ax....
bar_stacked
堆积条形图这是使用 bar 创建带有误差线的堆积条形图的示例。注意yerr用于误差条的参数,并且底部用于将女人的条形堆叠在男人条形的顶部。 ; 12345678910111213141516171819202122import numpy as npimport matplotlib.pyplot as pltN = 5menMeans = (20, 35, 30, 35, 27)womenMeans = (25, 32, 34, 20, 25)menStd = (2, 3, 4, 1, 2)womenStd = (3, 5, 2, 3, 3)ind = np.arange(N) # the x locations for the groupswidth = 0.35 # the width of the bars: can also be len(x) sequencep1 = plt.bar(ind, menMeans, width, yerr=menStd)p2 = plt.bar(ind, womenMeans, width, b...
barchart
条形图这是简单的条形图,在单个条形图上带有误差条形图和高度标签。 ; 123456789101112131415161718192021222324252627282930313233343536373839404142434445import numpy as npimport matplotlib.pyplot as pltmen_means, men_std = (20, 35, 30, 35, 27), (2, 3, 4, 1, 2)women_means, women_std = (25, 32, 34, 20, 25), (3, 5, 2, 3, 3)ind = np.arange(len(men_means)) # the x locations for the groupswidth = 0.35 # the width of the barsfig, ax = plt.subplots()rects1 = ax.bar(ind - width/2, men_means, width, yerr=men_std, color=...













