annotate_simple_coord02
简单Coord02注释示例 12345678910111213141516import matplotlib.pyplot as pltfig, ax = plt.subplots(figsize=(3, 2))an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", va="center", ha="center", bbox=dict(boxstyle="round", fc="w"))an2 = ax.annotate("Test 2", xy=(0.5, 1.), xycoords=an1, xytext=(0.5, 1.1), textcoords=(an1, "axes fraction"), va="bo...
annotate_simple_coord03
简单Coord03注释示例 1234567891011121314151617import matplotlib.pyplot as pltfrom matplotlib.text import OffsetFromfig, ax = plt.subplots(figsize=(3, 2))an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", va="center", ha="center", bbox=dict(boxstyle="round", fc="w"))offset_from = OffsetFrom(an1, (0.5, 0))an2 = ax.annotate("Test 2", xy=(0.1, 0.1), xycoords="data", ...
annotate_text_arrow
注释文本箭头123456789101112131415161718192021222324252627282930313233import numpy as npimport matplotlib.pyplot as pltfig, ax = plt.subplots(figsize=(5, 5))ax.set_aspect(1)x1 = -1 + np.random.randn(100)y1 = -1 + np.random.randn(100)x2 = 1. + np.random.randn(100)y2 = 1. + np.random.randn(100)ax.scatter(x1, y1, color="r")ax.scatter(x2, y2, color="g")bbox_props = dict(boxstyle="round", fc="w", ec="0.5", alpha=0.9)ax.text(-2, -2, "Sample A", h...
colormap_normalizations
色彩映射规范化演示使用norm以非线性方式映射颜色映射。 123import numpy as npimport matplotlib.pyplot as pltimport matplotlib.colors as colors Lognorm: Instead of pcolor log10(Z1) you can have colorbars that havethe exponential labels using a norm. 1234567891011121314151617181920N = 100X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]# A low hump with a spike coming out of the top. Needs to have# z/colour axis on a log scale so we see both hump and spike. linear# scale only shows the spike.Z1 = np.exp(-(X)**2 ...
colormap_normalizations_custom
色彩映射标准化自定义演示使用规范以非线性方式将颜色映射映射到数据上。 123456789101112131415161718192021222324252627282930313233343536373839404142import numpy as npimport matplotlib.pyplot as pltimport matplotlib.colors as colorsN = 100'''Custom Norm: An example with a customized normalization. This oneuses the example above, and normalizes the negative data differentlyfrom the positive.'''X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]Z1 = np.exp(-X**2 - Y**2)Z2 = np.exp(-(X - 1)**2 - (Y...
colormap_normalizations_bounds
色彩映射规范化边界演示使用规范以非线性方式将颜色映射映射到数据上。 123456789101112131415161718192021222324252627282930313233343536import numpy as npimport matplotlib.pyplot as pltimport matplotlib.colors as colorsN = 100X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]Z1 = np.exp(-X**2 - Y**2)Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)Z = (Z1 - Z2) * 2'''BoundaryNorm: For this one you provide the boundaries for your colors,and the Norm puts the first color in between the first pair, thesecond color between th...
colormap_normalizations_lognorm
颜色映射规格化演示使用规范以非线性方式将颜色映射映射到数据上。 123456789101112131415161718192021222324252627import numpy as npimport matplotlib.pyplot as pltimport matplotlib.colors as colors'''Lognorm: Instead of pcolor log10(Z1) you can have colorbars that havethe exponential labels using a norm.'''N = 100X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]# A low hump with a spike coming out of the top right. Needs to have# z/colour axis on a log scale so we see both hump and spike. l...
colormap_normalizations_symlognorm
色彩映射规范化Symlognorm演示使用规范以非线性方式将颜色映射映射到数据上。 12345678910111213141516171819202122232425262728293031import numpy as npimport matplotlib.pyplot as pltimport matplotlib.colors as colors"""SymLogNorm: two humps, one negative and one positive, The positivewith 5-times the amplitude. Linearly, you cannot see detail in thenegative hump. Here we logarithmically scale the positive andnegative data separately.Note that colorbar labels do not come out looking very good."""N =...
colormap_normalizations_power
颜色映射规格化功能演示使用规范以非线性方式将颜色映射映射到数据上。 123456789101112131415161718192021222324import numpy as npimport matplotlib.pyplot as pltimport matplotlib.colors as colorsN = 100X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]'''PowerNorm: Here a power-law trend in X partially obscures a rectifiedsine wave in Y. We can remove the power law using a PowerNorm.'''X, Y = np.mgrid[0:3:complex(0, N), 0:2:complex(0, N)]Z1 = (1 + np.sin(Y * 10.)) * X**(2.)fig, ax = plt.subplots...
connect_simple01
连接简单例子01 1234567891011121314151617181920212223242526272829from matplotlib.patches import ConnectionPatchimport matplotlib.pyplot as pltfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))xyA = (0.2, 0.2)xyB = (0.8, 0.8)coordsA = "data"coordsB = "data"con = ConnectionPatch(xyA, xyB, coordsA, coordsB, arrowstyle="-|>", shrinkA=5, shrinkB=5, mutation_scale=20, fc="w")ax1.plot([xyA[0], xyB[0]], [xyA[1], xyB[1]], ...














