def make_3DWB_water_profile(final_profile, water_ppmH2O_initial=None, initial_profile=None, initial_area_list=None, initial_area_positions_microns=None, show_plot=True, top=1.2, fig_ax=None): """Take a profile and initial water content. Returns the whole-block water concentration profile based on the profile's attribute wb_areas. If wb_areas have not been made, some initial profile information and various options are passed to make_3DWB_area_profile(). Default makes a plot showing A/Ao and water on parasite y-axis """ fin = final_profile init = initial_profile # Set initial water if water_ppmH2O_initial is not None: w0 = water_ppmH2O_initial else: if fin.sample is not None: if fin.sample.initial_water is not None: w0 = fin.sample.initial_water elif init is not None: if init.sample is not None: if init.sample.initial_water is not None: w0 = init.sample.initial_water else: print 'Need initial water content.' return False # Set whole-block areas if (fin.wb_areas is not None) and (len(fin.wb_areas) > 0): wb_areas = fin.wb_areas else: wb_areas = make_3DWB_area_profile(fin, initial_profile, initial_area_list, initial_area_positions_microns) water = wb_areas * w0 if show_plot is True: # Use a parasite y-axis to show water content fig = plt.figure() ax_areas = SubplotHost(fig, 1, 1, 1) fig.add_subplot(ax_areas) area_tick_marks = np.arange(0, 100, 0.2) ax_areas.set_yticks(area_tick_marks) ax_water = ax_areas.twin() ax_water.set_yticks(area_tick_marks) if isinstance(w0, uncertainties.Variable): ax_water.set_yticklabels(area_tick_marks * w0.n) else: ax_water.set_yticklabels(area_tick_marks * w0) ax_areas.axis["bottom"].set_label('Position ($\mu$m)') ax_areas.axis["left"].set_label('Final area / Initial area') ax_water.axis["right"].set_label('ppm H$_2$O') ax_water.axis["top"].major_ticklabels.set_visible(False) ax_water.axis["right"].major_ticklabels.set_visible(True) ax_areas.grid() ax_areas.set_ylim(0, 1.2) if fin.len_microns is not None: leng = fin.len_microns else: leng = fin.set_len() ax_areas.set_xlim(-leng / 2.0, leng / 2.0) style = fin.choose_marker_style() ax_areas.plot([-leng / 2.0, leng / 2.0], [1, 1], **style_1) ax_areas.plot(fin.positions_microns - leng / 2.0, wb_areas, **style) return water, fig, ax_areas else: return water
# now make the plot site_seq = plottingutils.getwtseq(infofn[namedict[fn]],barcodefn,datafnbase) fig = plt.figure() ax1 = SubplotHost(fig, 1,1,1) fig.add_subplot(ax1) ax2 = ax1.twin() ax1.imshow(emat,interpolation='nearest') ax1.set_xlabel('Position w.r.t. transcription start site') ax1.set_yticks([0,1,2,3]) ax1.set_yticklabels(['A','C','G','T']) # label positions with respect to transcription start site tick_start = int(start_dict[info_dict['exp_name']])+int(info_dict['mut_region_start']) tick_end = int(start_dict[info_dict['exp_name']])+int(info_dict['mut_region_start']) + int(info_dict['mut_region_length']) indices, xtick_labels = clean_up_xticklabels(tick_start,tick_end-tick_start) ax1.set_xticks(indices) ax1.set_xticklabels(xtick_labels) # put the sequence above it ax2.set_yticks([]) ax2.set_yticklabels([]) ax2.set_xticks(range(20)) ax2.set_xticklabels([bp for bp in site_seq])
emat0 = emat_mean emat = emat0 - emat0.min(axis=0) # now make the plot site_seq = plottingutils.getwtseq(infofn[namedict[fn]], barcodefn, datafnbase) fig = plt.figure() ax1 = SubplotHost(fig, 1, 1, 1) fig.add_subplot(ax1) ax2 = ax1.twin() ax1.imshow(emat, interpolation='nearest') ax1.set_xlabel('Position w.r.t. transcription start site') ax1.set_yticks([0, 1, 2, 3]) ax1.set_yticklabels(['A', 'C', 'G', 'T']) # label positions with respect to transcription start site tick_start = int(start_dict[info_dict['exp_name']]) + int( info_dict['mut_region_start']) tick_end = int(start_dict[info_dict['exp_name']]) + int( info_dict['mut_region_start']) + int( info_dict['mut_region_length']) indices, xtick_labels = clean_up_xticklabels(tick_start, tick_end - tick_start) ax1.set_xticks(indices) ax1.set_xticklabels(xtick_labels) # put the sequence above it ax2.set_yticks([])
stressSod[i] = np.max(s.sigmaEq) stressSod *= 1e-6 bar1 = (stressSod[-1], stressSod[1]-stressSod[-1]) bar2 = (stressSod[1], stressSod[0]-stressSod[1]) ax1.broken_barh([bar1, bar2], (31, 4), facecolors=(fillSod, fill), edgecolor=edgeSod,) for i in range(len(youngs)): ax1.annotate('${0:g}$'.format(youngs[i]*1e-9), \ xy=(stressSod[i], 36), \ xycoords='data', horizontalalignment=alignRev[i], fontsize=fs) #ax1.set_title('\\textbf{(b)} Molten salt') ax1.set_ylim(0, 40) ax1.set_yticks([5, 15, 25, 35]) ax1.set_yticklabels( ['$\\mathrm{DN}$\n\small{(-)}', '$\\lambda$\n\small{(\si{\watt\per\meter\per\kelvin})}', '$\\alpha$\n\small{(\SI{e-6}{\per\kelvin})}', '$E$\n\small{(GPa)}'], fontsize='large' ) ax1.set_xlim(150, 450) ax1.set_xlabel(r'\textsc{max. equiv. stress}, '+\ '$\max\sigma_\mathrm{Eq}$ (MPa)') fig1.tight_layout() #plt.show() fig1.savefig('S31609_sensitivityTubeProperties.pdf', transparent=True) plt.close(fig1)