mew=0, mec='w', label=label) # if label == 'Snake': # ax.loglog(mass[idx], np.sqrt(eps_snake[idx]), marker) ax.legend(loc='upper right', frameon=True, framealpha=.2, ncol=2) ax.set_xlabel('mass (g)', fontsize=16) ax.set_ylabel(r'$\epsilon$ ', fontsize=16, rotation=0) #ax.set_aspect('equal', adjustable='box') [ttl.set_size(16) for ttl in ax.get_xticklabels()] [ttl.set_size(16) for ttl in ax.get_yticklabels()] # https://stackoverflow.com/questions/21920233/matplotlib-log-scale-tick-label-number-formatting #from matplotlib.ticker import ScalarFormatter #for axis in [ax.xaxis, ax.yaxis]: # axis.set_major_formatter(ScalarFormatter()) from matplotlib import ticker ax.xaxis.set_major_formatter( ticker.FuncFormatter(lambda y, pos: ('{{:.{:1d}f}}'.format( int(np.maximum(-np.log10(y), 0)))).format(y))) ax.yaxis.set_major_formatter( ticker.FuncFormatter(lambda y, pos: ('{{:.{:1d}f}}'.format( int(np.maximum(-np.log10(y), 0)))).format(y))) rcj(ax) tl(fig) fig.savefig('Figures/figure8_epsilon.pdf', transparent=True)
ax5.set_ylabel(r'velocity, m/s') ax61.set_ylabel(r'$a_z / g$', fontsize=18) ax62.set_ylabel(r'$a_x / g$', fontsize=18) ax62.set_xlabel('distance, m') ax2.axhline(0, color='gray', alpha=.4) ax62.axhline(0, color='gray', linestyle='-', linewidth=.75) ax61.axhline(0, color='gray', linestyle='-', linewidth=.75) ax4.text(.9, 7.5, 'horizontal', color=bmap[0]) ax4.text(.9, -4.1, 'vertical', color=bmap[1]) ax5.text(.325, 5, 'horizontal', color=bmap[0]) ax5.text(1.3, -3.4, 'vertical', color=bmap[1]) ax2.axis('equal') rcj(ax2) axes = [ax1, ax12, ax13, ax3, ax4, ax5, ax61, ax62] figs = [fig1, fig11, fig2, fig3, fig4, fig5, fig6] [rcj(aa) for aa in axes] [tl(f) for f in figs] # concat all the DataFrames dfpx = pd.concat(dfpx, axis=1) dfpz = pd.concat(dfpz, axis=1) dfvx = pd.concat(dfvx, axis=1) dfvz = pd.concat(dfvz, axis=1) dfax = pd.concat(dfax, axis=1) dfaz = pd.concat(dfaz, axis=1) dfgm = pd.concat(dfgam, axis=1) dfvm = pd.concat(dfmag, axis=1)
plt.draw() # add degree symbol to angles ticks = ax.get_xticklabels() newticks = [] for tick in ticks: text = tick.get_text() newticks.append(text + u'\u00B0') ax.set_xticklabels(newticks) ax.text(5, 2.5, 'sugar glider', {'fontsize': 18}) [ttl.set_size(18) for ttl in ax.get_xticklabels()] [ttl.set_size(18) for ttl in ax.get_yticklabels()] rcj(ax) tl(fig) fig.savefig('Figures/figure4d_sugar_glider.pdf', transparent=True) # %% Find equilibrium points pitches = np.deg2rad(np.linspace(-25, 25, 4000)) gammas = np.deg2rad(np.linspace(0, 60, 1000)) arng = (angle_min, angle_max) from eqns import pitch_bifurcation as ptbi nt_Equil = ptbi(pitches, gammas, Cl_fun, Cd_fun, angle_rng=arngpt) nt_equil = ptbi(pitches, gammas, cl_fun, cd_fun, angle_rng=arngpt) nt_Equil_1 = ptbi(pitches, gammas, Cl_fun_1, Cd_fun_1, angle_rng=arng)
fig.canvas.draw() # add degree symbol to angles ticks = ax.get_xticklabels() newticks = [] for tick in ticks: text = tick.get_text() newticks.append(text + u'\u00B0') ax.set_xticklabels(newticks) ax.text(5, 2.5, 'airfoil snake', {'fontsize': 18}) [ttl.set_size(18) for ttl in ax.get_xticklabels()] [ttl.set_size(18) for ttl in ax.get_yticklabels()] rcj(ax) tl(fig) fig.savefig('Figures/figure4b_airfoil_snake.pdf', transparent=True) # %% Intersections with spline data (for paper about pitch effects) gamma = al cgamma = 1 / np.tan(gamma) pitch_array = np.deg2rad(np.array([-10, 10])) _gamma_equil = np.deg2rad(np.linspace(10, 70, 1000)) fig, ax = plt.subplots() ax.plot(np.rad2deg(gamma[gamma > 0]), cgamma[gamma > 0], c=bmap[2], lw=2,