def plotComponentStress(r, sigmaR, sigmaTheta, sigmaZ, sigmaEq, filename, i, loc): a = r[0,0]; b = r[0,-1] trX = Q_(1, 'inch').to('mm').magnitude trY = Q_(1, 'ksi').to('MPa').magnitude trans = mtransforms.Affine2D().scale(trX,trY) fig = plt.figure(figsize=(4, 3.5)) ax = SubplotHost(fig, 1, 1, 1) axa = ax.twin(trans) axa.set_viewlim_mode("transform") axa.axis["top"].set_label(r'\textsc{radius}, $r$ (in.)') axa.axis["top"].label.set_visible(True) axa.axis["right"].set_label(r'\textsc{stress component}, $\sigma$ (ksi)') axa.axis["right"].label.set_visible(True) ax = fig.add_subplot(ax) ax.plot(r[i,:]*1e3, sigmaR[i,:]*1e-6, '^-', label='$\sigma_r$') ax.plot(r[i,:]*1e3, sigmaTheta[i,:]*1e-6, 'o-', label=r'$\sigma_\theta$') ax.plot(r[i,:]*1e3, sigmaZ[i,:]*1e-6, 'v-', label='$\sigma_z$') ax.plot(r[i,:]*1e3, sigmaEq[i,:]*1e-6, 's-', label='$\sigma_\mathrm{eq}$') ax.set_xlabel(r'\textsc{radius}, $r$ (mm)') ax.set_xlim((a*1e3)-0.1,(b*1e3)+0.1) ax.set_ylabel(r'\textsc{stress component}, $\sigma$ (MPa)') ax.legend(loc=loc) #labels = ax.get_xticklabels() #plt.setp(labels, rotation=30) fig.tight_layout() fig.savefig(filename, transparent=True) plt.close(fig)
def plotNACA(r, sigma, fea, i, filename, loc, ylabel): a = r[0,0]; b = r[0,-1] trX = Q_(1, 'inch').to('mm').magnitude trY = Q_(1, 'ksi').to('MPa').magnitude trans = mtransforms.Affine2D().scale(trX,trY) fig = plt.figure(figsize=(4, 3.5)) ax = SubplotHost(fig, 1, 1, 1) axa = ax.twin(trans) axa.set_viewlim_mode("transform") axa.axis["top"].set_label(r'\textsc{radius}, $r$ (in.)') axa.axis["top"].label.set_visible(True) axa.axis["right"].set_label(ylabel+' (ksi)') axa.axis["right"].label.set_visible(True) ax = fig.add_subplot(ax) ax.plot(r[0,:]*1e3, sigma[0,:]*1e-6, '-', color='C0',label=r'$\theta=0^\circ$') ax.plot((a+fea[0][:,0])*1e3, fea[0][:,i]*1e-6, 'o', color='C0', markevery=1) ax.plot(r[0,:]*1e3, sigma[20,:]*1e-6, '-', color='C1', label=r'$\theta=60^\circ$') ax.plot((a+fea[1][:,0])*1e3, fea[1][:,i]*1e-6, '^', color='C1', markevery=1) ax.plot(r[0,:]*1e3, sigma[40,:]*1e-6, '-', color='C2', label=r'$\theta=120^\circ$') ax.plot((a+fea[2][:,0])*1e3, fea[2][:,i]*1e-6, 'v', color='C2', markevery=1) ax.plot(r[0,:]*1e3, sigma[60,:]*1e-6, '-', color='C3', label=r'$\theta=180^\circ$') ax.plot((a+fea[3][:,0])*1e3, fea[3][:,i]*1e-6, 's', color='C3', markevery=1) ax.set_xlabel(r'\textsc{radius}, $r$ (mm)') ax.set_xlim((a*1e3)-10,(b*1e3)+10) ax.set_ylabel(ylabel+' (MPa)') #ax.set_ylim(-400, 400) c0line = Line2D([], [], color='C0', marker='o', label=r'$\theta=0^\circ$') c1line = Line2D([], [], color='C1', marker='^', label=r'$\theta=60^\circ$') c2line = Line2D([], [], color='C2', marker='v', label=r'$\theta=120^\circ$') c3line = Line2D([], [], color='C3', marker='s', label=r'$\theta=180^\circ$') handles=[c0line, c1line, c2line, c3line] labels = [h.get_label() for h in handles] ax.legend([handle for i,handle in enumerate(handles)], [label for i,label in enumerate(labels)], loc=loc) fig.tight_layout() fig.savefig(filename, transparent=True) plt.close(fig)
def plotTIMO(r, s, feaCmp, feaEq, filename): a = r[0,0]; b = r[0,-1] trX = Q_(1, 'inch').to('mm').magnitude trY = Q_(1, 'ksi').to('MPa').magnitude trans = mtransforms.Affine2D().scale(trX,trY) fig = plt.figure(figsize=(4, 3.5)) ax = SubplotHost(fig, 1, 1, 1) axa = ax.twin(trans) axa.set_viewlim_mode("transform") axa.axis["top"].set_label(r'\textsc{radius}, $r$ (in.)') axa.axis["top"].label.set_visible(True) axa.axis["right"].set_label(r'\textsc{stress component}, $\sigma$ (ksi)') axa.axis["right"].label.set_visible(True) ax = fig.add_subplot(ax) ax.plot(r[0,:]*1e3, s.sigmaTheta[0,:]*1e-6, '-', color='C0') ax.plot((a+feaCmp[:,0])*1e3, feaCmp[:,4]*1e-6, 'o', color='C0') ax.plot(r[0,:]*1e3, s.sigmaR[0,:]*1e-6, '-', color='C1') ax.plot((a+feaCmp[:,0])*1e3, feaCmp[:,5]*1e-6, '^', color='C1') ax.plot(r[0,:]*1e3, s.sigmaZ[0,:]*1e-6, '-', color='C2') ax.plot((a+feaCmp[:,0])*1e3, feaCmp[:,6]*1e-6, 'v', color='C2') ax.plot(r[0,:]*1e3, s.sigmaEq[0,:]*1e-6, '-', color='C3') ax.plot((a+feaEq[:,0])*1e3, feaEq[:,1]*1e-6, 's', color='C3') ax.plot(r[0,:]*1e3, s.sigmaRTheta[0,:]*1e-6, '-', color='C4') ax.plot((a+feaCmp[:,0])*1e3, feaCmp[:,7]*1e-6, '+', color='C4') ax.set_xlabel(r'\textsc{radius}, $r$ (mm)') ax.set_xlim((a*1e3)-10,(b*1e3)+10) ax.set_ylabel(r'\textsc{stress component}, $\sigma$ (MPa)') #ax.set_ylim(-400, 400) c0line = Line2D([], [], color='C0', marker='o', label=r'$\sigma_\theta$') c1line = Line2D([], [], color='C1', marker='^', label=r'$\sigma_r$') c2line = Line2D([], [], color='C2', marker='v', label=r'$\sigma_z$') c3line = Line2D([], [], color='C3', marker='s', label=r'$\sigma_\mathrm{eq}$') c4line = Line2D([], [], color='C4', marker='+', label=r'$\tau_{r\theta}$') handles=[c0line, c1line, c2line, c4line, c3line] labels = [h.get_label() for h in handles] ax.legend([handle for i,handle in enumerate(handles)], [label for i,label in enumerate(labels)], loc='best') fig.tight_layout() fig.savefig(filename, transparent=True) plt.close(fig)
alpha=0.6) ax.plot(x, Peak3450, '3', label='~3450 cm$^{-1}$', markersize=12, mew=2, color='blue', clip_on=False) ax.plot(x, Peak3330, 'd', label='~3330 cm$^{-1}$', markersize=8, mew=1, color='violet', clip_on=False, alpha=0.5) ax.set_xlim(-1.8, -0.2) ax.legend(loc=4, ncol=1, fontsize=10, fancybox=True) ##fig.autofmt_xdate() plt.tight_layout() plt.savefig('Fig10_Fe.eps', format='eps', dpi=1000) fig.savefig('Fig10_Fe.tif', format='tif', dpi=300) fig.savefig('CpxDiffusivities.svg', format='svg') plt.show(fig) print 'Finished'
ax3_Eh.axhline(arrow_Kii.stop, linestyle="--", color="b", label="K w.r.t. parent ion at infinity") # K_threshold arrow_Kt = arrow(name="K_threshold", start=start, length=K_thres, is_energy=True) arrow_Kt.Plot(ax3_Eh, x=-3.0 * Ip_dr, color="r", label="$K_{threshold}$", horizontalalignment="left") ax3_Eh.axhline(arrow_Kt.stop, linestyle="--", color="r", label="K w.r.t. threshold ($V_b$)") # Can it ionize? ax3_Eh.set_title(r"Can ionize: " + can_ionize_yes_no) ax3_Eh.set_ylabel("Hartree") ax3_eV.set_ylabel("eV") ax3_Eh.set_xlim((-0.2, 0.4)) ax3_Eh.set_ylim((-0.5, 1.1 * max(arrow_Ip.stop, arrow_K.stop))) leg = ax3_Eh.legend(loc="best") leg.get_frame().set_alpha(0.4) # ****************************************************************************** # Set plot properties # ****************************************************************************** # Default the xlim be r[0] and r[-1] if plot_V: ax_V_Eh.set_xlim((r[0], r[-1])) if plot_U: ax_U_Eh.set_xlim((r[0], r[-1])) # Make sure the ions' label are visible if plot_V: ylim = ax_V_Volt.get_ylim()
ax.add_patch(fbox) ax.text(-1.07, xenoDmin + 0.5*xenoDrange, 'peridotite\nmantle\ncpx?', ha='left', va='center') # #### Diopside # # ########### plot all peak-specific together ################# ax.plot(x, Peak3645, label='~3645 cm$^{-1}$', markersize=12, mew=2, color='r', marker='x', linestyle='none', clip_on=False) ax.plot(x, Peak3540, label='~3540 cm$^{-1}$', markersize=7, mew=1, color='teal', marker='s', linestyle='none', clip_on=False, alpha=0.6) ax.plot(x, Peak3450, '3', label='~3450 cm$^{-1}$', markersize=12, mew=2, color='blue', clip_on=False) ax.plot(x, Peak3330, 'd', label='~3330 cm$^{-1}$', markersize=8, mew=1, color='violet', clip_on=False, alpha=0.5) ax.set_xlim(-1.8, -0.2) ax.legend(loc=4, ncol=1, fontsize=10, fancybox=True) ##fig.autofmt_xdate() plt.tight_layout() plt.savefig('Fig10_Fe.eps', format='eps', dpi=1000) fig.savefig('Fig10_Fe.tif', format='tif', dpi=300) fig.savefig('CpxDiffusivities.svg', format='svg') plt.show(fig) print 'Finished'