mri_with_eeg
MRI与脑电图显示一组带有MRI图像的子图,其强度直方图和一些EEG轨迹。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869import numpy as npimport matplotlib.pyplot as pltimport matplotlib.cbook as cbookimport matplotlib.cm as cmfrom matplotlib.collections import LineCollectionfrom matplotlib.ticker import MultipleLocatorfig = plt.figure("MRI_with_EEG")# Load the MRI data (256x256 16 bit integers)with cbook.get_sample_data('s1045.im...
mri_demo
MRI此示例说明如何将(MRI)图像读入NumPy阵列,并使用imshow以灰度显示。 123456789101112131415import matplotlib.pyplot as pltimport matplotlib.cbook as cbookimport matplotlib.cm as cmimport numpy as np# Data are 256x256 16 bit integerswith cbook.get_sample_data('s1045.ima.gz') as dfile: im = np.fromstring(dfile.read(), np.uint16).reshape((256, 256))fig, ax = plt.subplots(num="MRI_demo")ax.imshow(im, cmap=cm.gray)ax.axis('off')plt.show() 下载这个示例 下载python源码: mri_demo.py 下载Jupyter notebook:...
radar_chart
雷达图(又名蜘蛛星图)此示例创建雷达图表,也称为蜘蛛星图。 虽然此示例允许“圆”或“多边形”的框架,但多边形框架没有合适的网格线(线条是圆形而不是多边形)。 通过将matplotlib.axis中的GRIDLINE_INTERPOLATION_STEPS设置为所需的顶点数,可以获得多边形网格,但多边形的方向不与径向轴对齐。 http://en.wikipedia.org/wiki/Radar_chart 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313...
sankey_basics
桑基图类通过生成三个基本图表来演示Sankey类。 123import matplotlib.pyplot as pltfrom matplotlib.sankey import Sankey 示例1 - 主要是默认值 这演示了如何通过隐式调用Sankey.add()方法并将finish()附加到类的调用来创建一个简单的图。 1234Sankey(flows=[0.25, 0.15, 0.60, -0.20, -0.15, -0.05, -0.50, -0.10], labels=['', '', '', 'First', 'Second', 'Third', 'Fourth', 'Fifth'], orientations=[-1, 1, 0, 1, 1, 1, 0, -1]).finish()plt.title("The default settings produce a dia...
sankey_links
使用Sankey的长链连接通过建立长链连接来演示/测试Sankey类。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748import matplotlib.pyplot as pltfrom matplotlib.sankey import Sankeylinks_per_side = 6def side(sankey, n=1): """Generate a side chain.""" prior = len(sankey.diagrams) for i in range(0, 2*n, 2): sankey.add(flows=[1, -1], orientations=[-1, -1], patchlabel=str(prior + i), prior=prior + i - ...
sankey_rankine
朗肯动力循环通过朗肯动力循环的实际示例演示Sankey类。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475import matplotlib.pyplot as pltfrom matplotlib.sankey import Sankeyfig = plt.figure(figsize=(8, 9))ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[], title="Rankine Power Cycle: Example 8.6 from Moran and " "Shapiro\n\x22Fundamentals of Engineering Thermodynamics "...
system_monitor
系统监视器 输出: 175.0 frames per second 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import timeimport matplotlib.pyplot as pltimport numpy as npdef get_memory(t): "Simulate a function that returns system memory" return 100 * (0.5 + 0.5 * np.sin(0.5 * np.pi * t))def get_cpu(t): "Simulate a function that returns cpu usage" return 100 * (0.5 + 0.5 * np.sin(0.2 * np.pi * (t - 0.25)))def get_net...
skewt
SkewT-logP图:使用变换和自定义投影这可以作为matplotlib变换和自定义投影API的强化练习。 这个例子产生了一个所谓的SkewT-logP图,它是气象学中用于显示温度垂直剖面的常见图。 就matplotlib而言,复杂性来自于X轴和Y轴不正交。 这是通过在基本Axes变换中包含一个偏斜分量来处理的。 处理上下X轴具有不同数据范围的事实带来了额外的复杂性,这需要一系列用于刻度,棘轮和轴的自定义类来处理这一问题。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130...
topographic_hillshading
地形山体阴影在“山体阴影”图上展示不同混合模式和垂直夸大的视觉效果。 请注意,“叠加”和“柔和”混合模式适用于复杂曲面,例如此示例,而默认的“hsv”混合模式最适用于光滑曲面,例如许多数学函数。 在大多数情况下,山体阴影纯粹用于视觉目的,可以安全地忽略dx / dy。 在这种情况下,您可以通过反复试验调整vert_exag(垂直夸大)以获得所需的视觉效果。 但是,此示例演示了如何使用dx和dy kwargs来确保vert_exag参数是真正的垂直夸大。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.cbook import get_sample_datafrom matplotlib.colors import LightSourcewith np.load(get_samp...
barchart_demo
条形图演示使用Matplotlib的许多形状和大小的条形图。 条形图对于可视化计数或带有误差栏的汇总统计信息非常有用。这些示例显示了使用Matplotlib执行此操作的几种方法。 12345678910111213141516171819202122232425262728293031323334353637383940414243# Credit: Josh Hemannimport numpy as npimport matplotlib.pyplot as pltfrom matplotlib.ticker import MaxNLocatorfrom collections import namedtuplen_groups = 5means_men = (20, 35, 30, 35, 27)std_men = (2, 3, 4, 1, 2)means_women = (25, 32, 34, 20, 25)std_women = (3, 5, 2, 3, 3)fig, ax = plt.subplots()index = np.arange(n_groups)bar_...














