本文整理汇总了Python中matplotlib.pylab.pause方法的典型用法代码示例。如果您正苦于以下问题:Python pylab.pause方法的具体用法?Python pylab.pause怎么用?Python pylab.pause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.pylab
的用法示例。
在下文中一共展示了pylab.pause方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _show_video
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import pause [as 别名]
def _show_video(video, fps=10):
# Import matplotlib/pylab only if needed
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pylab as pl
pl.style.use('ggplot')
pl.axis('off')
if fps < 0:
fps = 25
video /= 255. # Pylab works in [0, 1] range
img = None
pause_length = 1. / fps
try:
for f in range(video.shape[0]):
im = video[f, :, :, :]
if img is None:
img = pl.imshow(im)
else:
img.set_data(im)
pl.pause(pause_length)
pl.draw()
except:
pass
示例2: test_fields_E
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import pause [as 别名]
def test_fields_E(self):
F = fdtd(self.eps_r, dL=self.dL, npml=self.pml)
fig, ax = plt.subplots(figsize=(10, 10))
im = ax.pcolormesh(np.zeros((self.Nx, self.Ny)), cmap='RdBu')
for t_index in range(self.steps):
fields = F.forward(Jz=self.gaussian(t_index))
if t_index % self.skip_rate == 0:
max_E = np.abs(fields['Ez']).max()
im.set_array(fields['Ez'][:, :, 0].ravel())
im.set_clim([-1, 1])
plt.pause(0.001)
ax.set_title('time = {}'.format(t_index))
示例3: test_fields_H
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import pause [as 别名]
def test_fields_H(self):
F = fdtd(self.eps_r, dL=self.dL, npml=self.pml)
fig, ax = plt.subplots(figsize=(10, 10))
im = ax.pcolormesh(np.zeros((self.Nx, self.Ny)), cmap='RdBu')
for t_index in range(self.steps):
fields = F.forward(Jx=self.gaussian(t_index))
if t_index % self.skip_rate == 0:
max_E = np.abs(fields['Hz']).max()
im.set_array(fields['Hz'][:, :, 0].ravel())
im.set_clim([-1, 1])
plt.pause(0.001)
ax.set_title('time = {}'.format(t_index))
示例4: show
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import pause [as 别名]
def show():
args = get_args()
# Load model
nn.load_parameters(args.model_load_path)
params = nn.get_parameters()
# Show heatmap
for name, param in params.items():
# SSL only on convolution weights
if "conv/W" not in name:
continue
print(name)
n, m, k0, k1 = param.d.shape
w_matrix = param.d.reshape((n, m * k0 * k1))
# Filter x Channel heatmap
fig, ax = plt.subplots()
ax.set_title("{} with shape {} \n Filter x (Channel x Heigh x Width)".format(
name, (n, m, k0, k1)))
heatmap = ax.pcolor(w_matrix)
fig.colorbar(heatmap)
plt.pause(0.5)
raw_input("Press Key")
plt.close()