def main(W=0.05, L=25, config=1, plot_phase=None, plot=False, save_plot=False, threshold_left=None, threshold_right=None): """docstring for main""" L = L*W snapshots_x_values = [7*W, 9.75*W, L/2, 15.25*W, 18*W] exp_setup = dict(N=2.6, L=L, W=W, x_R0=0.16*W, y_R0=1.25/W, init_phase=-1.8/W, loop_type='Bell', tN=500) WG_exp = DirichletReduced(**exp_setup) effective_setup = exp_setup.copy() effective_setup.update(dict(y_R0=2.*exp_setup['y_R0'], init_phase=exp_setup['init_phase'] + exp_setup['y_R0'])) WG_eff = DirichletReduced(**effective_setup) # show eps, delta values at start/end of absorber snapshots_delta_values = [] for n, s in enumerate(snapshots_x_values): s_eps_delta = WG_eff.get_cycle_parameters(s) print "configuration {} at x={:.5f}: eps={:.5f} delta={: .5f}".format(n, s, s_eps_delta[0]/W, s_eps_delta[1]*W) snapshots_delta_values.append(s_eps_delta[-1]*W) if config == n: eps_reduced_model, delta_reduced_model = s_eps_delta x0 = s if plot_phase is None and threshold_left is None and threshold_right is None: if config == 0: plot_phase = 1.4 threshold_left = 0.35 threshold_left_absorber = 0.465 elif config == 1: plot_phase = -np.pi threshold_left = 0.1925 threshold_left_absorber = 0.225 elif config == 2: plot_phase = np.pi threshold_left = 0.31 threshold_left_absorber = 0.32 elif config == 3: plot_phase = +1.9 threshold_left = 0.507 threshold_left_absorber = 0.522 elif config == 4: plot_phase = -1.0 threshold_left = 0.7375 threshold_left_absorber = 0.705 plot_phase = -2.*WG_exp.y_R0*x0**2/L eps, delta = WG_exp.get_cycle_parameters() x = WG_exp.t f_absorber = interp1d(*np.loadtxt("peaks_interactive.dat", unpack=True)) y_absorber = 1.*x absorber_cutoff = (x > 7.*W) & (x < 18.*W) y_absorber[absorber_cutoff] = f_absorber(x[absorber_cutoff]) y_absorber[x < 7*W] = np.nan y_absorber[x > 18*W] = np.nan def xi(eps, delta, plot_phase=0.0, x=x): return eps*np.sin((WG_exp.kr + delta)*x + plot_phase) f, (ax, ax3, ax4) = plt.subplots(nrows=3, figsize=(10., 6), dpi=120) # experimental WG ax.plot(x, -xi(eps, delta) + W, "k-") ax.plot(x, -xi(eps, delta), "k-") ax.plot(x, y_absorber - xi(eps, delta), ls="-", lw=3, color=c[1]) ax.set_xlabel(r"$x$", labelpad=-5.0) ax.set_ylabel(r"$y$", labelpad=2.0) ax.set_xlim(0, L) ax.set_ylim(-0.01, 0.06) ax2 = ax.twiny() ax2.set_xlim(0, L) ax2.set_xticks(snapshots_x_values) ax2.set_xticklabels([str(t) for t in snapshots_x_values]) for tick in ax2.get_xaxis().get_major_ticks(): tick.set_pad(0.0) ax2.grid(True, lw=1.) # linearized 2x2 parameter path eps_linearized, delta_linearized = WG_eff.get_cycle_parameters() ax3.plot(delta_linearized*W, eps_linearized/W, "k-", lw=0.75) ax3.plot(delta_linearized[absorber_cutoff]*W, eps_linearized[absorber_cutoff]/W, ls="-", lw=3, color=c[1]) ax3.set_xlabel(r"$\delta\cdot W$", labelpad=-5.0) ax3.set_ylabel(r"$\sigma/W$", labelpad=2.0) ax3.set_xlim(-3.1, 2) ax33 = ax3.twiny() ax33.set_xlim(-3.1, 2) ax33.set_xticks(snapshots_delta_values) ax33.set_xticklabels(["{:.3f}".format(t) for t in snapshots_delta_values]) for tick in ax33.get_xaxis().get_major_ticks(): tick.set_pad(0.0) ax33.grid(True, lw=1.) snapshots_y_values = [0.095, 0.1416, 0.16] ax333 = ax3.twinx() ax333.set_ylim(0, 0.18) ax333.set_yticks(snapshots_y_values) ax333.set_yticklabels([str(t) for t in snapshots_y_values]) for tick in ax33.get_yaxis().get_major_ticks(): tick.set_pad(0.0) ax333.grid(True, lw=1.) # comparison periodic system and experiment ax4.plot(x, -xi(eps, delta) + W, "k-", lw=0.25) ax4.plot(x, -xi(eps, delta), "k-", lw=0.25) ax4.plot(x, y_absorber - xi(eps, delta), ls="-", lw=1, color=c[1]) xi_periodic = xi(eps_reduced_model, delta_reduced_model, plot_phase) ax4.plot(x, -xi_periodic, "k-") ax4.plot(x, W - xi_periodic, "k-") ax4.set_xlim(0, L) ax4.set_ylim(-0.01, 0.06) ax4.set_xlabel(r"$x$", labelpad=-5.0) ax4.set_ylabel(r"$y$", labelpad=2.0) ax5 = ax4.twiny() ax5.set_xlim(0, L) ax5.set_xticks(snapshots_x_values) ax5.set_xticklabels([str(t) for t in snapshots_x_values]) for tick in ax5.get_xaxis().get_major_ticks(): tick.set_pad(0.0) ax5.grid(True, lw=1.) # extract a half period of the absorber wavelength = 2.*np.pi/(WG_eff.kr + delta_reduced_model) dx = wavelength/4. piece_mask = (x > x0 - dx) & (x < x0 + dx) a = y_absorber[piece_mask] ax5.plot(x[piece_mask], a - xi_periodic[piece_mask], "y-") for axis in (ax, ax3, ax4): axis.yaxis.set_major_locator(MaxNLocator(nbins=3)) ax4.set_ylim(-0.01, 0.06) periodic_absorber = np.concatenate([a, a[::-1]]*4 + [a]) elements = len(periodic_absorber)/len(a) if config == 0: piece_mask = (x > x0) & (x < x0 + dx) if config == 4: piece_mask = (x > x0 - dx) & (x < x0) if config == 0 or config == 4: a = y_absorber[piece_mask] periodic_absorber = np.concatenate(8*[W - a[::-1], W - a, a[::-1], a]) elements = len(periodic_absorber)/len(a)/2. x_elements = np.linspace(x0 - elements*dx, x0 + elements*dx, len(periodic_absorber)) # start at maximum of boundary oscillation -> different for each configuration maximum_mask = (x_elements > threshold_left) & (x_elements < threshold_left + 4*wavelength) maximum_mask_absorber = (x_elements > threshold_left_absorber) & (x_elements < threshold_left_absorber + 4*wavelength) x_file = x_elements y_file = periodic_absorber xi_file = xi(eps_reduced_model, delta_reduced_model, x=x_file) m = maximum_mask_absorber ax6 = ax4.twiny() ax6.set_xlim(0, L) ax6.set_ylim(-0.01, 0.06) ax6.set_xticks([x0 - dx, x0 + dx]) ax6.set_xticklabels([str("") for t in ax6.get_xticks()]) ax6.grid(True, lw=1., color="darkgrey") ax6.plot(x_file[m], y_file[m] - xi(eps_reduced_model, delta_reduced_model, plot_phase=plot_phase, x=x_file)[m], "r-") if plot: plt.tight_layout() f.subplots_adjust(bottom=0.1, left=0.09, top=0.9, right=0.9) if save_plot: plt.savefig("summary_config_{}".format(config)) else: plt.show() # save file: x in [0, 4*lambda], y in [0, 1] print print "kr", WG_exp.kr print "delta_reduced_model", delta_reduced_model print "Omega", (WG_exp.kr + delta_reduced_model) print print "wavelength", wavelength print "4*wavelength", 4*wavelength print "wavelength/W", wavelength/W print "4*wavelength/W", 4*wavelength/W print x_file = x_file[maximum_mask] y_file = y_file[maximum_mask_absorber] xi_file = xi_file[maximum_mask] # print "len(x_file)", len(x_file) # print "len(y_file)", len(y_file) # print "len(xi_file)", len(xi_file) if len(x_file) > len(y_file): x_file = x_file[:len(y_file)] xi_file = xi_file[:len(y_file)] else: y_file = y_file[:len(x_file)] # print "len(x_file)", len(x_file) # print "len(y_file)", len(y_file) # print "len(xi_file)", len(xi_file) np.savetxt("periodic_configuration_{}.dat".format(config), # zip((x_file - x_file[0])/(x_file[-1] - x_file[0])*4*wavelength/W, zip((x_file - x_file[0])/W, y_file/W, xi_file), header="x, y_absorber (relative coordinates), xi(x) (boundary modulation)") np.savetxt("experimental_configuration_{}.dat".format(config), # zip((x_file - x_file[0])/(x_file[-1] - x_file[0])*4*wavelength, zip(x_file - x_file[0], 2*W - (y_file + xi_file + eps_reduced_model), 2*W - (xi_file + eps_reduced_model), 2*W - (xi_file + eps_reduced_model + W)), header="x, y_absorber (absolute coordinates), xi_lower xi_upper")
def plot_parameter_trajectory_p1_p2(W=1.0, remove_inside=False, show=False): wg_kwargs = dict(N=2.05, L=25*W, W=W, x_R0=0.1*W, y_R0=0.85/W, init_phase=0.3/W, eta=0.6/W, switch_losses_on_off=True, loop_type='Bell', tN=50) # wg_kwargs = dict(N=2.5, # L=25*W, # W=W, # x_R0=0.25*W, # y_R0=0.5/W, # init_phase=-0.3/W, # eta=0.3/W, # switch_losses_on_off=True, # loop_type='Bell') WGam = DirichletReduced(**wg_kwargs) eps, delta = WGam.get_cycle_parameters() eps_EP, delta_EP = WGam.x_EP, WGam.y_EP f, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(6.2, 2.1), dpi=220) phi = lambda e, d: np.arctan2((d - WGam.init_phase)/WGam.y_R0, e/WGam.x_R0) R = lambda e, d: np.hypot(e/WGam.x_R0, (d - WGam.init_phase)/WGam.y_R0) get_p1 = lambda e, d: R(e, d)*np.sin(2*phi(e, d)) get_p2 = lambda e, d: R(e, d)*np.cos(2*phi(e, d)) # plt.plot(WGam.t, R(eps, delta)) # plt.show() EPS, DELTA = np.meshgrid(eps, delta) delta_to_eps = lambda d: WGam.x_R0*0.5*(1. + np.cos(np.pi*(d - WGam.init_phase)/WGam.y_R0)) mask = EPS < delta_to_eps(DELTA) EPS, DELTA = [X[mask] for X in (EPS, DELTA)] eps_im_branch_cut = np.linspace(eps_EP, eps.max()*1.5, 100) delta_im_branch_cut = 0.*eps_im_branch_cut eps_re_branch_cut = np.linspace(0.0, eps_EP, 100) delta_re_branch_cut = delta_im_branch_cut delta_horizontal_line = np.linspace(delta[0], delta[-1], 100) eps_const = 0.*delta_horizontal_line + 1e-2 p1 = get_p1(eps, delta) p2 = get_p2(eps, delta) p1_EP = get_p1(eps_EP, delta_EP) p2_EP = get_p2(eps_EP, delta_EP) P1 = get_p1(EPS, DELTA) P2 = get_p2(EPS, DELTA) def from_p(p1, p2): eps_from_p = np.sqrt(p1**2 + p2**2 + p2*np.sqrt(p1**2 + p2**2))/np.sqrt(2.) delta_from_p = p1/2.*np.sqrt(p1**2 + p2**2)/eps_from_p delta_from_p = delta_from_p*WGam.y_R0 + WGam.init_phase eps_from_p *= WGam.x_R0 return eps_from_p, delta_from_p def get_circles(pp1, pp2, p1_0=0.0, p2_0=0.0, radius=0.5): R_circle = radius*np.hypot(p2_0 - pp2, p1_0 - pp1) phi_circle = np.arctan2(-p2_0 + pp2, -p1_0 + pp1) p1_circle = p1_0 + R_circle*np.cos(phi_circle) p2_circle = p2_0 + R_circle*np.sin(phi_circle) eps_circle, delta_circle = from_p(p1_circle, p2_circle) return p1_circle, p2_circle, eps_circle, delta_circle # p1_circle, p2_circle, eps_circle, delta_circle = get_circles(p1, p2, radius=0.5) # ax1.plot(p1, p2, "r-") # ax1.plot(p1_circle, p2_circle, "b-") # ax1.plot(p1_EP, p2_EP, "ko") # ax2.plot(delta_circle, eps_circle, "r-") # ax2.plot(delta, eps, "b-") # ax2.plot(delta_EP, eps_EP, "ko") # plt.show() if remove_inside: xydata = np.dstack([p1, p2]) xydata = xydata.reshape((-1, 2)) curve = Path(xydata) P1_P2_flat = np.vstack([P1.flatten(), P2.flatten()]).T inside = curve.contains_points(P1_P2_flat, radius=0.0) P1, P2 = [Z[~inside] for Z in (P1, P2)] p1_im_branch_cut = get_p1(eps_im_branch_cut, delta_im_branch_cut) p2_im_branch_cut = get_p2(eps_im_branch_cut, delta_im_branch_cut) p1_re_branch_cut = get_p1(eps_re_branch_cut, delta_re_branch_cut) p2_re_branch_cut = get_p2(eps_re_branch_cut, delta_re_branch_cut) p1_line_2 = get_p1(eps_const, delta_horizontal_line) p2_line_2 = get_p2(eps_const, delta_horizontal_line) plot_kwargs = dict(lw=1.0, ms=0.5, mec='none', clip_on=False) # ax1.plot(DELTA, EPS, "o", color=colors[-1], **plot_kwargs) # ax2.plot(P1, P2, "o", color=colors[-1], **plot_kwargs) radii = np.linspace(1., 0.0, 10) for n, r in enumerate(radii): if r < 0.825: r = r*1.075 step = 10 p1_p, p2_p = [np.concatenate([u[::step], [u[0]]]) for u in (p1, p2)] tck, _ = scipy.interpolate.splprep([p1_p, p2_p], k=5)#, s = np.linspace(0.0, 1.0, 1000) p1_p, p2_p = scipy.interpolate.splev(s, tck) p1_0, p2_0 = p1_EP, p2_EP r_smaller = True else: # p1_p, p2_p = p1, p2 # p1_0, p2_0 = 0., 0. p1_p, p2_p = p1, p2 p1_0, p2_0 = p1_EP*(1.-r**3), p2_EP*(1.-r**3) r_smaller = False (p1_circle, p2_circle, eps_circle, delta_circle) = get_circles(p1_p, p2_p, p1_0=p1_0, p2_0=p2_0, radius=r) n = n/(len(radii)) if not r_smaller: n = 1./6. # ax1.plot(delta_circle, eps_circle, "-", color=parula(n), lw=0.25) # ax2.plot(p1_circle, p2_circle, "-", color=parula(n), lw=0.25) ax1.fill(delta_circle, eps_circle, "-", color=parula(n), lw=0.25) ax2.fill(p1_circle, p2_circle, "-", color=parula(n), lw=0.25) ax1.plot(delta, eps, color="k", lw=2.0) #**plot_kwargs) ax1.plot(delta[0], eps[0], "o", color="k", ms=7.5, mec='none') ax1.plot(delta[-1], eps[-1], "o", color="k", ms=7.5, mec='none') ax1.plot(delta_re_branch_cut, eps_re_branch_cut, "--", color="k", **plot_kwargs) ax1.plot(delta_im_branch_cut[::5], eps_im_branch_cut[::5], "o", color="k", ms=2.0, mec='none') # ax1.plot(delta_horizontal_line, eps_const, "-", color=colors[1], **plot_kwargs) ax1.plot(delta_EP, eps_EP, "o", color="w", ms=5, mec='k') ax1.annotate('EP', (0.075, 0.04), textcoords='data', weight='bold', size=12, color='black') ax1.set_xlim(-0.7, 1.3) ax1.set_ylim(-0.0075, WGam.x_R0 + 0.005) ax1.set_xlabel(r"Detuning $\delta$") ax1.set_ylabel(r"Amplitude $\sigma$") # ax1.locator_params(axis='x', nbins=4) # ax1.locator_params(axis='y', nbins=4) ax2.plot(p1, p2, color="k", lw=2.0) #**plot_kwargs) ax2.plot(p1[0], p2[0], "o", color="k", ms=7.5, mec='none') ax2.plot(p1[-1], p2[-1], "o", color="k", ms=7.5, mec='none') ax2.plot(p1_re_branch_cut, p2_re_branch_cut, "--", color="k", **plot_kwargs) ax2.plot(p1_im_branch_cut[::10], p2_im_branch_cut[::10], "o", color="k", ms=2.0, mec='none') # ax2.plot(p1_line_2, p2_line_2, "-", color=colors[1], **plot_kwargs) ax2.plot(p1_EP, p2_EP, "o", color="w", ms=5, mec='k') ax2.annotate('EP', (-0.45, 0.04), textcoords='data', weight='bold', size=12, color='black') ax2.set_xlim(-0.85, 0.85) ax2.set_ylim(-1.15, 1.05) ax2.set_xlabel(r"$p_1$") ax2.set_ylabel(r"$p_2$") ax2.locator_params(axis='x', nbins=4) ax2.locator_params(axis='y', nbins=4) for ax in (ax1, ax2): ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('left') ax.get_xaxis().set_tick_params(direction='out') ax.get_yaxis().set_tick_params(direction='out') ax1.annotate('a', (1.1, 0.1), textcoords='data', weight='bold', size=12, color='black') ax2.annotate('b', (0.7, 1.0), textcoords='data', weight='bold', size=12, color='black') plt.tight_layout() if show: plt.show() else: # plt.savefig("Fig2_alt.png", bbox_inches='tight') plt.savefig("Fig2_alt.pdf", bbox_inches='tight')
def main(W=0.05, L=25, phase=None, plot=False, save_plot=False, lw=0.75): """docstring for main""" L = L*W snapshots_x_values = [7*W, 9.75*W, L/2, 15.25*W, 18*W] exp_setup = dict(N=2.6, L=L, W=W, x_R0=0.16*W, y_R0=1.25/W, init_phase=-1.8/W, loop_type='Bell', tN=500) WG_exp = DirichletReduced(**exp_setup) effective_setup = exp_setup.copy() effective_setup.update(dict(y_R0=2.*exp_setup['y_R0'], init_phase=exp_setup['init_phase'] + exp_setup['y_R0'])) WG_eff = DirichletReduced(**effective_setup) # show eps, delta values at start/end of absorber snapshots_delta_values = [] for n, s in enumerate(snapshots_x_values): s_eps_delta = WG_eff.get_cycle_parameters(s) print "configuration {} at x={:.5f}: eps={:.5f} delta={: .5f}".format(n, s, s_eps_delta[0]/W, s_eps_delta[1]*W) snapshots_delta_values.append(s_eps_delta[-1]*W) eps, delta = WG_exp.get_cycle_parameters() x = WG_exp.t f_absorber = interp1d(*np.loadtxt("peaks_interactive_RAP.dat", unpack=True)) y_absorber = 1.*x absorber_cutoff = (x > 7.*W) & (x < 18.*W) y_absorber[absorber_cutoff] = f_absorber(x[absorber_cutoff]) y_absorber[x < 7*W] = np.nan y_absorber[x > 18*W] = np.nan def xi(eps, delta, x=x, plot_phase=0.0): return eps*np.sin((WG_exp.kr + delta)*x + plot_phase) f = plt.figure(figsize=(6.3, 4.0), dpi=220) ax1 = plt.subplot2grid((3, 1), (0, 0), rowspan=1) ax2 = plt.subplot2grid((3, 1), (1, 0), rowspan=1) ax3 = plt.subplot2grid((3, 1), (2, 0), rowspan=1) f.text(0.0, 0.96, 'a', weight='bold', size=12) f.text(0.0, 0.64, 'b', weight='bold', size=12) f.text(0.0, 0.28, 'c', weight='bold', size=12) configuration_labels = ("I", "II", "III", "IV", "V") # experimental WG ax1.plot(x, -xi(eps, delta) + W, "k-", lw=lw) ax1.plot(x, -xi(eps, delta), "k-", lw=lw) ax1.plot(x, y_absorber - xi(eps, delta), ls="-", lw=3, color=c[1]) ax1.set_xlabel(r"Spatial coordinate $x$", labelpad=1.5) ax1.set_ylabel(r"$y$") #, labelpad=2.0) ax1.set_xlim(0, L) ax1.set_ylim(-0.01, 0.06) ax1.set_xticks([0, 7*W, 12.5*W, 18*W, L]) ax1.set_xticklabels([r"$0$", r"$7W$", r"$12.5W$", r"$18W$", r"$25W$"]) ax1.set_yticks([0.0, 0.05]) ax1.set_yticklabels([r"$0$", r"$W$"]) ax11 = ax1.twiny() ax11.set_xlim(0, L) ax11.set_xticks(snapshots_x_values) # linearized 2x2 parameter path eps_linearized, delta_linearized = WG_eff.get_cycle_parameters() ax2.plot(delta_linearized*W, eps_linearized/W, "k-", lw=lw) # ax2.plot(delta_linearized[absorber_cutoff]*W, # eps_linearized[absorber_cutoff]/W, ls="-", lw=3, color=c[1]) ax2.set_xlabel(r"$\delta\cdot W$", labelpad=1.5) ax2.set_ylabel(r"$\sigma/W$") #, labelpad=2.0) ax2.set_xlim(-3.1, 2) ax2.set_ylim(0.0, 0.18) ax2.set_yticks(np.linspace(0.0, 0.18, 4)) ax22 = ax2.twiny() ax22.set_xlim(-3.1, 2) ax22.set_xticks(snapshots_delta_values) # plot snapshot III x0 = snapshots_x_values[2] eps_reduced_model, delta_reduced_model = WG_eff.get_cycle_parameters(x0) plot_phase = -2.*WG_exp.y_R0*x0**2/L xi_periodic = xi(eps_reduced_model, delta_reduced_model, plot_phase=plot_phase) wavelength = 2.*np.pi/(WG_eff.kr + delta_reduced_model) dx = wavelength/4. x = WG_eff.t a = y_absorber[(x > x0 - dx) & (x < x0 + dx)] periodic_absorber = np.concatenate([a, a[::-1]]*10 + [a]) elements = len(periodic_absorber)/len(a) x_elements = np.linspace(x0 - elements*dx, x0 + elements*dx, len(periodic_absorber)) plot_mask = (x_elements > 0.32) & (x_elements < 0.32 + 4*wavelength) plot_mask = x_elements == x_elements x_file = x_elements[plot_mask] y_file = periodic_absorber[plot_mask] xi_file = xi(eps_reduced_model, delta_reduced_model, x=x_file, plot_phase=plot_phase) ax3.plot(x, -xi(eps, delta) + W, "-", color=c[-1], lw=lw) ax3.plot(x, -xi(eps, delta), "-", color=c[-1], lw=lw) ax3.plot(x, y_absorber - xi(eps, delta), ls="-", lw=3., color=c[-1]) ax3.set_xlabel(r"Spatial coordinate $x$", labelpad=1.5) ax3.set_ylabel(r"$y$") ax3.set_xlim(0, L) ax3.set_ylim(-0.01, 0.06) ax3.set_xticks([0, 7*W, 12.5*W, 18*W, L]) ax3.set_xticklabels([r"$0$", r"$7W$", r"$12.5W$", r"$18W$", r"$25W$"]) ax3.set_yticks([0.0, 0.05]) ax3.set_yticklabels([r"$0$", r"$W$"]) ax3.plot(x, -xi_periodic, "k-", lw=lw) ax3.plot(x, W - xi_periodic, "k-", lw=lw) ax3.plot(x_file, y_file - xi(eps_reduced_model, delta_reduced_model, plot_phase=plot_phase, x=x_file), "-", color=c[1], lw=3.) ax33 = ax3.twiny() ax33.set_xlim(0, L) ax33.set_xticks([12.5*W]) ax33.set_xticklabels([r"III"]) for ax in (ax1, ax11, ax2, ax22, ax3, ax33): ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) ax.get_xaxis().set_tick_params(direction='out') ax.get_yaxis().set_tick_params(direction='out') ax.tick_params(axis='both', which='minor', bottom='off', left='off', right='off', top='off') ax.tick_params(axis='both', which='major', bottom='on', left='on', right='off', top='off') for ax in (ax1, ax2, ax3): for tick in ax.get_xaxis().get_major_ticks(): tick.set_pad(1.0) for ax in (ax11, ax22, ax33): ax.grid(True, lw=1.) if ax != ax33: ax.set_xticklabels(configuration_labels) ax.tick_params(axis='both', which='major', bottom='off', left='on', right='off', top='off') for tick in ax.get_xaxis().get_major_ticks(): tick.set_pad(-4.0) if plot: plt.tight_layout(pad=1.25) f.subplots_adjust(bottom=0.10, left=0.1, top=0.95, right=0.95) if save_plot: plt.savefig("waveguide.pdf") else: plt.show()