本文整理汇总了Python中matplotlib.pylab.subplots_adjust方法的典型用法代码示例。如果您正苦于以下问题:Python pylab.subplots_adjust方法的具体用法?Python pylab.subplots_adjust怎么用?Python pylab.subplots_adjust使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.pylab
的用法示例。
在下文中一共展示了pylab.subplots_adjust方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot1D_mat
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import subplots_adjust [as 别名]
def plot1D_mat(a, b, M, title=''):
""" Plot matrix M with the source and target 1D distribution
Creates a subplot with the source distribution a on the left and
target distribution b on the tot. The matrix M is shown in between.
Parameters
----------
a : ndarray, shape (na,)
Source distribution
b : ndarray, shape (nb,)
Target distribution
M : ndarray, shape (na, nb)
Matrix to plot
"""
na, nb = M.shape
gs = gridspec.GridSpec(3, 3)
xa = np.arange(na)
xb = np.arange(nb)
ax1 = pl.subplot(gs[0, 1:])
pl.plot(xb, b, 'r', label='Target distribution')
pl.yticks(())
pl.title(title)
ax2 = pl.subplot(gs[1:, 0])
pl.plot(a, xa, 'b', label='Source distribution')
pl.gca().invert_xaxis()
pl.gca().invert_yaxis()
pl.xticks(())
pl.subplot(gs[1:, 1:], sharex=ax1, sharey=ax2)
pl.imshow(M, interpolation='nearest')
pl.axis('off')
pl.xlim((0, nb))
pl.tight_layout()
pl.subplots_adjust(wspace=0., hspace=0.2)
示例2: plot_angular_velocities
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import subplots_adjust [as 别名]
def plot_angular_velocities(title,
angular_velocities,
angular_velocities_filtered,
block=True):
fig = plt.figure()
title_position = 1.05
fig.suptitle(title, fontsize='24')
a1 = plt.subplot(1, 2, 1)
a1.set_title(
"Angular Velocities Before Filtering \nvx [red], vy [green], vz [blue]",
y=title_position)
plt.plot(angular_velocities[:, 0], c='r')
plt.plot(angular_velocities[:, 1], c='g')
plt.plot(angular_velocities[:, 2], c='b')
a2 = plt.subplot(1, 2, 2)
a2.set_title(
"Angular Velocities After Filtering \nvx [red], vy [green], vz [blue]", y=title_position)
plt.plot(angular_velocities_filtered[:, 0], c='r')
plt.plot(angular_velocities_filtered[:, 1], c='g')
plt.plot(angular_velocities_filtered[:, 2], c='b')
plt.subplots_adjust(left=0.025, right=0.975, top=0.8, bottom=0.05)
if plt.get_backend() == 'TkAgg':
mng = plt.get_current_fig_manager()
max_size = mng.window.maxsize()
max_size = (max_size[0], max_size[1] * 0.45)
mng.resize(*max_size)
plt.show(block=block)
示例3: plot_results
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import subplots_adjust [as 别名]
def plot_results(times_A, times_B, signal_A, signal_B,
convoluted_signals, time_offset, block=True):
fig = plt.figure()
title_position = 1.05
matplotlib.rcParams.update({'font.size': 20})
# fig.suptitle("Time Alignment", fontsize='24')
a1 = plt.subplot(1, 3, 1)
a1.get_xaxis().get_major_formatter().set_useOffset(False)
plt.ylabel('angular velocity norm [rad]')
plt.xlabel('time [s]')
a1.set_title(
"Before Time Alignment", y=title_position)
plt.hold("on")
min_time = min(np.amin(times_A), np.amin(times_B))
times_A_zeroed = times_A - min_time
times_B_zeroed = times_B - min_time
plt.plot(times_A_zeroed, signal_A, c='r')
plt.plot(times_B_zeroed, signal_B, c='b')
times_A_shifted = times_A + time_offset
a3 = plt.subplot(1, 3, 2)
a3.get_xaxis().get_major_formatter().set_useOffset(False)
plt.ylabel('correlation')
plt.xlabel('sample idx offset')
a3.set_title(
"Correlation Result \n[Ideally has a single dominant peak.]",
y=title_position)
plt.hold("on")
plt.plot(np.arange(-len(signal_A) + 1, len(signal_B)), convoluted_signals)
a2 = plt.subplot(1, 3, 3)
a2.get_xaxis().get_major_formatter().set_useOffset(False)
plt.ylabel('angular velocity norm [rad]')
plt.xlabel('time [s]')
a2.set_title(
"After Time Alignment", y=title_position)
plt.hold("on")
min_time = min(np.amin(times_A_shifted), np.amin(times_B))
times_A_shifted_zeroed = times_A_shifted - min_time
times_B_zeroed = times_B - min_time
plt.plot(times_A_shifted_zeroed, signal_A, c='r')
plt.plot(times_B_zeroed, signal_B, c='b')
plt.subplots_adjust(left=0.04, right=0.99, top=0.8, bottom=0.15)
if plt.get_backend() == 'TkAgg':
mng = plt.get_current_fig_manager()
max_size = mng.window.maxsize()
max_size = (max_size[0], max_size[1] * 0.45)
mng.resize(*max_size)
plt.show(block=block)
示例4: plot_time_stamped_poses
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import subplots_adjust [as 别名]
def plot_time_stamped_poses(title,
time_stamped_poses_A,
time_stamped_poses_B,
block=True):
fig = plt.figure()
title_position = 1.05
fig.suptitle(title + " [A = top, B = bottom]", fontsize='24')
a1 = plt.subplot(2, 2, 1)
a1.set_title(
"Orientation \nx [red], y [green], z [blue], w [cyan]",
y=title_position)
plt.plot(time_stamped_poses_A[:, 4], c='r')
plt.plot(time_stamped_poses_A[:, 5], c='g')
plt.plot(time_stamped_poses_A[:, 6], c='b')
plt.plot(time_stamped_poses_A[:, 7], c='c')
a2 = plt.subplot(2, 2, 2)
a2.set_title(
"Position (eye coordinate frame) \nx [red], y [green], z [blue]", y=title_position)
plt.plot(time_stamped_poses_A[:, 1], c='r')
plt.plot(time_stamped_poses_A[:, 2], c='g')
plt.plot(time_stamped_poses_A[:, 3], c='b')
a3 = plt.subplot(2, 2, 3)
plt.plot(time_stamped_poses_B[:, 4], c='r')
plt.plot(time_stamped_poses_B[:, 5], c='g')
plt.plot(time_stamped_poses_B[:, 6], c='b')
plt.plot(time_stamped_poses_B[:, 7], c='c')
a4 = plt.subplot(2, 2, 4)
plt.plot(time_stamped_poses_B[:, 1], c='r')
plt.plot(time_stamped_poses_B[:, 2], c='g')
plt.plot(time_stamped_poses_B[:, 3], c='b')
plt.subplots_adjust(left=0.025, right=0.975, top=0.8, bottom=0.05)
if plt.get_backend() == 'TkAgg':
mng = plt.get_current_fig_manager()
max_size = mng.window.maxsize()
max_size = (max_size[0], max_size[1] * 0.45)
mng.resize(*max_size)
plt.show(block=block)