def plot_d0_rho(data): plotkws = {'x': d0_col, 'y': 'density', 'sizecol': 'count', #'groupby': 'case', #'c': 'case', 'scale': 0.1, 'colorbar': False, 'xlim': [0.5,6], 'ylim': [0,450], 'alpha': 0.5} ax = sf.plot_pairs(data.loc['first'], c=(.6, .6 , .92, .8), label='BAECC', **plotkws) sf.plot_pairs(data.loc['second'], c=(.2, .92, .2, .8), ax=ax, label='winter 2014-2015', **plotkws) plt.tight_layout() rho_d0, rho_d0_baecc, rho_d0_1415 = prepare_d0_rho(data) rho_d0_baecc.plot(ax=ax) rho_d0_1415.plot(ax=ax) rho_d0.plot(ax=ax, color='black', label='all cases: $%s$' % str(rho_d0)) for key, kws in fits_to_plot.items(): key.plot(ax=ax, **kws) read.rho_scale(ax.yaxis) ax.set_ylabel('$\\rho$, ' + read.RHO_UNITS) ax.set_xlabel('$D_0$, mm') ax.set_xticks((0.5, 1, 2, 3, 4, 5, 6)) plt.legend() return ax, rho_d0, rho_d0_baecc, rho_d0_1415
def plot_d0_rho(data): plotkws = { 'x': d0_col, 'y': 'density', 'sizecol': 'count', #'groupby': 'case', #'c': 'case', 'scale': 0.1, 'colorbar': False, 'xlim': [0.5, 6], 'ylim': [0, 450], 'alpha': 0.5 } ax = sf.plot_pairs(data.loc['first'], c=(.6, .6, .92, .8), label='BAECC', **plotkws) sf.plot_pairs(data.loc['second'], c=(.2, .92, .2, .8), ax=ax, label='winter 2014-2015', **plotkws) plt.tight_layout() rho_d0, rho_d0_baecc, rho_d0_1415 = prepare_d0_rho(data) rho_d0_baecc.plot(ax=ax) rho_d0_1415.plot(ax=ax) rho_d0.plot(ax=ax, color='black', label='all cases: $%s$' % str(rho_d0)) for key, kws in fits_to_plot.items(): key.plot(ax=ax, **kws) read.rho_scale(ax.yaxis) ax.set_ylabel('$\\rho$, ' + read.RHO_UNITS) ax.set_xlabel('$D_0$, mm') ax.set_xticks((0.5, 1, 2, 3, 4, 5, 6)) plt.legend() return ax, rho_d0, rho_d0_baecc, rho_d0_1415
def plot_density_histogram(data, bins=60, **kws): ax = data.density.hist(bins=bins, **kws) read.rho_scale(ax.xaxis) ax.set_xlabel('bulk density') ax.set_ylabel('frequency')
row.label, ha='right', va='bottom', weight='heavy') markerplot = 'intensity' markers(sample, ax=axdict[markerplot], ycol=markerplot, yloc='above') gray_out(sample, axdict, facecolor='0.85') #series_ax[0].set_title(case.dtstr()) fit_ax[0].set_ylabel('$v$, m$\,$s$^{-1}$') fit_ax[1].set_xlabel('$D$, mm') labels = [a.get_xticklabels() for a in series_ax[:-1]] labels.extend([a.get_yticklabels() for a in fit_ax[1:]]) plt.setp(labels, visible=False) axdict['intensity'].set_ylabel('$LWE$, mm$\,$h$^{-1}$') axdict['density'].set_ylabel('$\\rho$, ' + read.RHO_UNITS) read.rho_scale(axdict['density'].yaxis) axdict[d0_col].set_ylabel('mm') axdict['N_w'].set_ylabel('$N_w$, mm$^{-1}\,$m$^{-3}$') tfmt = DateFormatter('%H:%M') series_ax[-1].xaxis.set_major_formatter(tfmt) # saving savekws = {'dpi': 150, 'bbox_inches': 'tight'} savename = case.dtstr('%Y%m%d') figtld = '.eps' try: fig.savefig(path.join(savedir, savename + figtld), **savekws) except ValueError as err: warnings.warn("ValueError: {0} Skipping plot for the {1} case.".format( err, case.dtstr())) if not debug and event.case_study == True: # yes, necessary to check for True fig.savefig(path.join(paths['paper'], savename + figtld), **savekws)
sample['ax'] = fit_ax for i, row in sample.iterrows(): row.ax.text(extent[1]-0.2, extent[2], row.label, ha='right', va='bottom', weight='heavy') markerplot = 'intensity' markers(sample, ax=axdict[markerplot], ycol=markerplot, yloc='above') gray_out(sample, axdict, facecolor='0.85') #series_ax[0].set_title(case.dtstr()) fit_ax[0].set_ylabel('$v$, m$\,$s$^{-1}$') fit_ax[1].set_xlabel('$D$, mm') labels = [a.get_xticklabels() for a in series_ax[:-1]] labels.extend([a.get_yticklabels() for a in fit_ax[1:]]) plt.setp(labels, visible=False) axdict['intensity'].set_ylabel('$LWE$, mm$\,$h$^{-1}$') axdict['density'].set_ylabel('$\\rho$, ' + read.RHO_UNITS) read.rho_scale(axdict['density'].yaxis) axdict[d0_col].set_ylabel('mm') axdict['N_w'].set_ylabel('$N_w$, mm$^{-1}\,$m$^{-3}$') tfmt = DateFormatter('%H:%M') series_ax[-1].xaxis.set_major_formatter(tfmt) # saving savekws = {'dpi': 150, 'bbox_inches': 'tight'} savename = case.dtstr('%Y%m%d') figtld = '.eps' try: fig.savefig(path.join(savedir, savename + figtld), **savekws) except ValueError as err: warnings.warn("ValueError: {0} Skipping plot for the {1} case.".format(err, case.dtstr())) if not debug and event.case_study==True: # yes, necessary to check for True fig.savefig(path.join(paths['paper'], savename + figtld), **savekws) data.to_csv(path.join(paths['tables'], savename + '.csv'))