Python matplotlib.pylab.subplots_adjust() Examples
The following are 4
code examples of matplotlib.pylab.subplots_adjust().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.pylab
, or try the search function
.
Example #1
Source File: plot.py From POT with MIT License | 5 votes |
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)
Example #2
Source File: time_alignment_plotting_tools.py From hand_eye_calibration with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #3
Source File: time_alignment_plotting_tools.py From hand_eye_calibration with BSD 3-Clause "New" or "Revised" License | 4 votes |
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)
Example #4
Source File: time_alignment_plotting_tools.py From hand_eye_calibration with BSD 3-Clause "New" or "Revised" License | 4 votes |
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)