def plot_scatter(self, data, type1, type2, funct1=doNothing, funct2=doNothing): self.init_newPlot() try: x = funct1(data[type1]) y = funct2(data[type2]) except KeyError: self.plot.draw() return if (np.all(np.isnan(x))) or (np.all(np.isnan(x))): return try: plotDensityScatter(x, y, cmap='viridis', alpha=1, skip=1, y_factor=1, s=5, levels=None, loglog=False, ax=self.plot.axes) self.plot_data = np.array([x, y]) self.plot_data_frame = data self.plot.axes.set_xlabel(type1) self.plot.axes.set_ylabel(type2) except (ValueError, np.LinAlgError): print("kernel density estimation failed? not enough cells found?") return
def plotPathList(paths): global ax paths = list(paths) print(paths) fit_data = [] data_list = [] for index, file in enumerate(paths): output_file = Path(str(file).replace("_result.txt", "_evaluated.csv")) # load the data and the config data = getData(file) config = getConfig(file) """ evaluating data""" if not output_file.exists(): #refetchTimestamps(data, config) getVelocity(data, config) # take the mean of all values of each cell data = data.groupby(['cell_id']).mean() correctCenter(data, config) data = filterCells(data, config) # reset the indices data.reset_index(drop=True, inplace=True) getStressStrain(data, config) #data = data[(data.stress < 50)] data.reset_index(drop=True, inplace=True) data["area"] = data.long_axis * data.short_axis * np.pi data.to_csv(output_file, index=False) data = pd.read_csv(output_file) #data = data[(data.area > 0) * (data.area < 2000) * (data.stress < 250)] #data.reset_index(drop=True, inplace=True) data_list.append(data) data = pd.concat(data_list) data.reset_index(drop=True, inplace=True) fitStiffness(data, config) plotDensityScatter(data.stress, data.strain) #plotStressStrainFit(data, config) plotBinnedData(data.stress, data.strain, [0, 10, 20, 30, 40, 50, 75, 100, 125, 150, 200, 250]) #plt.title(f'{config["fit"]["p"][0] * config["fit"]["p"][1]:.2f}') fit_data.append(config["fit"]["p"][0] * config["fit"]["p"][1]) return fit_data
def plot_stress_strain(self): filename = self.db.getImage(0).get_full_filename() self.plot.axes.clear() #plt.sca(self.plot.axes) x = self.data.stress y = self.data.strain plotDensityScatter(x, y, ax=self.plot.axes) self.plot_data = np.array([x, y]) #self.plot.axes.plot(stress_values, strain_values, "o") self.plot.axes.set_xlabel("stress") self.plot.axes.set_ylabel("strain") self.plot.axes.set_xlim(-10, 400) self.plot.figure.tight_layout() self.plot.draw()
import pylustrator pylustrator.start() for index, pressure in enumerate([1]): ax = plt.subplot(1, 3, index + 1) data, config = load_all_data([ r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_21_alginate2%_dmem_NIH_time_2\[0-9]\*_result.txt", r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_may\2020_05_22_alginateDMEM2%\[0-9]\*_result.txt", r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_27_alginate2%_dmem_NIH_time_1\[0-9]\*_result.txt", ], pressure=pressure) plt.subplot(1, 2, 1) plotDensityScatter(data.rp, data.angle) plt.subplot(1, 2, 2) plotDensityScatter(data.rp, np.sqrt(data.area / np.pi)) #plt.legend() #% start: automatic generated code from pylustrator plt.figure(1).ax_dict = {ax.get_label(): ax for ax in plt.figure(1).axes} import matplotlib as mpl plt.figure(1).set_size_inches(12.000000 / 2.54, 4.370000 / 2.54, forward=True) plt.figure(1).axes[0].set_position([0.118367, 0.241321, 0.356764, 0.716233]) plt.figure(1).axes[0].set_xlim(-90.0, 90.0) plt.figure(1).axes[0].set_xticklabels(["-75", "0", "75"]) plt.figure(1).axes[0].set_xticks([-75.0, 0.0, 75.0]) plt.figure(1).axes[0].set_xticks([np.nan], minor=True) plt.figure(1).axes[0].spines['right'].set_visible(False)
plt.legend(fontsize=8) plt.xlabel("k") plt.ylabel("alpha") plt.xlim(left=0) plt.ylim(bottom=0) if name.endswith("nM"): plt.figure(3) #for dose response plt.plot(float(name[:-3]), stat_k[0], "o") plt.xscale("log") plt.figure(4) #strain versus stress plt.subplot(rows, cols, index + 1) # plot_joint_density(data.k_cell, data.alpha_cell, label=name, only_kde=True) plt.title(name, fontsize=10) plotDensityScatter(data.stress, data.strain) plt.xlim(0, 320) plt.ylim(0, 1.5) plt.xlabel("shear stress (Pa)") plt.ylabel(row_title + "strain") #plt.tight_layout() plt.figure(5) # velocity versus radial position plt.subplot(rows, cols, index + 1) plt.title(name, fontsize=10) plot_velocity_fit(data) plt.grid() plt.xlim(0, 100) all_plots_same_limits() #plt.ylim(0, 1.5) plt.xlabel("channel position (µm)") plt.ylabel(row_title + "velocity\n(cm/s)")
def plot_joint_density(x, y, label=None, only_kde=False, color=None, growx=1, growy=1, offsetx=0): ax = plt.gca() x1, y1, w, h = ax.get_position().x0, ax.get_position().y0, ax.get_position( ).width, ax.get_position().height wf, hf = ax.figure.get_size_inches() gap = 0.05 fraction = 0.2 width_of_hist = np.mean([(w * wf * fraction), (h * hf * fraction)]) hist_w = width_of_hist / wf hist_h = width_of_hist / hf h *= growy w *= growx if getattr(ax, "ax2", None) is None: ax.ax2 = plt.axes( [x1 + offsetx * w, y1 + h - hist_h + gap / hf, w - hist_w, hist_h], sharex=ax, label=ax.get_label() + "_top") #ax.ax2.set_xticklabels([]) ax.ax2.spines['right'].set_visible(False) ax.ax2.spines['top'].set_visible(False) ax.ax2.tick_params(axis='y', colors='none', which="both", labelcolor="none") ax.ax2.tick_params(axis='x', colors='none', which="both", labelcolor="none") ax.ax2.spines['left'].set_visible(False) ax.spines['top'].set_visible(False) plt.sca(ax.ax2) plot_density_hist(x, color=color, only_kde=only_kde) if getattr(ax, "ax3", None) is None: ax.ax3 = plt.axes( [x1 + offsetx * w + w - hist_w + gap / wf, y1, hist_w, h - hist_h], sharey=ax, label=ax.get_label() + "_right") #ax.ax3.set_yticklabels([]) ax.set_position([x1 + offsetx * w, y1, w - hist_w, h - hist_h]) ax.ax3.spines['right'].set_visible(False) ax.ax3.spines['top'].set_visible(False) ax.ax3.tick_params(axis='x', colors='none', which="both", labelcolor="none") ax.ax3.tick_params(axis='y', colors='none', which="both", labelcolor="none") #ax.ax3.spines['left'].set_visible(False) ax.ax3.spines['bottom'].set_visible(False) ax.spines['right'].set_visible(False) plt.sca(ax.ax3) l = plot_density_hist(y, color=color, orientation=u'horizontal', only_kde=only_kde) plt.sca(ax) plotDensityScatter(x, y, cmap=colormap("C2", -0.5, 0), s=1) #plt.plot(x, y, "o", c=color, alpha=0.5, ms=1) #plotDensityLevels(x, y, levels=1, colors=[l.get_color()], cmap=None) plt.plot([], [], color=l.get_color(), label=label)
return np.real(G), np.imag(G) def cost(p): Gp1, Gp2 = fit(data.omega, *p) return np.sum((np.log10(data.Gp1) - np.log10(Gp1))**2) + np.sum( (np.log10(data.Gp2) - np.log10(Gp2))**2) from scipy.optimize import minimize res = minimize(cost, [80, 0.5], bounds=([0, np.inf], [0, 1])) print(res) #plt.loglog(data.omega, data.Gp1, "o", alpha=0.25, label="G'", ms=1) plt.loglog([], [], "o", alpha=0.25, label="G'", ms=1) plotDensityScatter(data.omega, data.Gp1, colormap("C0", 0, 0.5), alpha=0.25, s=1) plt.plot([1e-1, 1e0, 1e1, 3e1], fit([1e-1, 1e0, 1e1, 3e1], *res.x)[0], "-", color=darken("C0", 0.3), lw=0.8) #plt.loglog(data.omega, data.Gp2, "o", alpha=0.25, label="G''", ms=1) plt.loglog([], [], "o", alpha=0.25, label="G''", ms=1) plotDensityScatter(data.omega, data.Gp2, colormap("C1", -0.75, 0), alpha=0.25,
w = omega(data.velocity_gradient) k = data.stress / ((data.strain - p[2]) * (np.abs(w) + (v / (np.pi * 2 * config["imaging_pos_mm"])))**p[1]) return k for i in range(3): data, config = position_list[i] plt.subplot(1, 3, 1 + i) k = get_k(data, config) #plotStressStrain(data, config) plotDensityScatter(np.abs(data.rp), k, skip=1, y_factor=0.33) plotBinnedData(np.abs(data.rp), k, np.arange(0, 90, 10), bin_func=np.median, error_func="quantiles") plt.xlim(0, 100) plt.ylim(0, 200) #% start: automatic generated code from pylustrator plt.figure(1).ax_dict = {ax.get_label(): ax for ax in plt.figure(1).axes} import matplotlib as mpl plt.figure(1).set_size_inches(16.250000 / 2.54, 5.000000 / 2.54, forward=True) plt.figure(1).axes[0].set_position([0.124970, 0.226507, 0.245158, 0.648012]) plt.figure(1).axes[0].set_ylim(0.0, 220.0)
# get the results file (by command line parameter or user input dialog) datafile = getInputFile(filetype="csv file (*_evaluated_new.csv)", settings_name=settings_name, video=file) print("evaluate file", datafile) # load the data and the config data, config = load_all_data_new(datafile) plt.figure(0, (10, 8)) plt.subplot(2, 3, 1) plt.cla() plot_velocity_fit(data) plt.text(0.9, 0.9, f"$\\eta_0$ {data.eta0[0]:.2f}\n$\\delta$ {data.delta[0]:.2f}\n$\\tau$ {data.tau[0]:.2f}", transform=plt.gca().transAxes, va="top", ha="right") plt.subplot(2, 3, 2) plt.cla() plotDensityScatter(data.stress, data.epsilon) plotBinnedData(data.stress, data.epsilon, bins=np.arange(0, 300, 10)) plt.xlabel("stress (Pa)") plt.ylabel("strain") plt.subplot(2, 3, 3) plt.cla() plotDensityScatter(data.rp, data.angle) plotBinnedData(data.rp, data.angle, bins=np.arange(-300, 300, 10)) plt.xlabel("radial position (µm)") plt.ylabel("angle (deg)") plt.subplot(2, 3, 4) plt.loglog(data.omega, data.Gp1, "o", alpha=0.25) plt.loglog(data.omega, data.Gp2, "o", alpha=0.25) plt.ylabel("G' / G''")
numbers = [] for index, pressure in enumerate([1, 2, 3]): ax = plt.subplot(1, 3, index+1) #data, config = load_all_data(r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data"+ # r"\microscope4\2020_may\2020_05_22_alginateDMEM2%\[0-9]\*_result.txt", pressure=pressure) data, config = load_all_data([ r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_29_aslginate2%_NIH_diff_x_position_2\inlet\[0-9]\*_result.txt", r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_29_aslginate2%_NIH_diff_x_position_3\inlet\[0-9]\*_result.txt", # r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_21_alginate2%_dmem_NIH_time_2\[0-9]\*_result.txt", # r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_may\2020_05_22_alginateDMEM2%\[0-9]\*_result.txt", # r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_27_alginate2%_dmem_NIH_time_1\[0-9]\*_result.txt", ], pressure=pressure) plotDensityScatter(data.rp, data.strain) numbers.append(len(data.rp)) print(config) print("numbers", numbers) #% start: automatic generated code from pylustrator plt.figure(1).ax_dict = {ax.get_label(): ax for ax in plt.figure(1).axes} import matplotlib as mpl plt.figure(1).set_size_inches(16.260000/2.54, 4.390000/2.54, forward=True) plt.figure(1).axes[0].set_position([0.115765, 0.257929, 0.268860, 0.717020]) plt.figure(1).axes[0].set_xlim(-90.0, 90.0) plt.figure(1).axes[0].set_xticklabels(["-75", "0", "75"]) plt.figure(1).axes[0].set_xticks([-75.0, 0.0, 75.0]) plt.figure(1).axes[0].set_xticks([np.nan], minor=True) plt.figure(1).axes[0].spines['right'].set_visible(False)
def selected(self, name): plt.clf() if name.endswith(".tif"): data, config = load_all_data_new(name.replace( ".tif", "_evaluated_new.csv"), do_excude=False) def get_mode_stats(x): from scipy import stats from deformationcytometer.evaluation.helper_functions import bootstrap_error x = np.array(x) print("a", x.shape) if len(x.shape) == 1: x = x[~np.isnan(x)] print("b", x.shape) def get_mode(x): kde = stats.gaussian_kde(x) print(x.shape) print(np.argmax(kde(x))) return x[..., np.argmax(kde(x))] mode = get_mode(x) # err = bootstrap_error(x, get_mode, repetitions=2) return mode from scipy.special import gamma def fit(omega, k, alpha): omega = np.array(omega) G = k * (1j * omega)**alpha * gamma(1 - alpha) return np.real(G), np.imag(G) def cost(p): Gp1, Gp2 = fit(data.omega_weissenberg, *p) #return np.sum(np.abs(np.log10(data.w_Gp1) - np.log10(Gp1))) + np.sum( # np.abs(np.log10(data.w_Gp2) - np.log10(Gp2))) return np.sum( (np.log10(data.w_Gp1) - np.log10(Gp1))**2) + np.sum( (np.log10(data.w_Gp2) - np.log10(Gp2))**2) from scipy.optimize import minimize res = minimize( cost, [np.median(data.w_k_cell), np.mean(data.w_alpha_cell)]) #, bounds=([0, np.inf], [0, 1])) print(res) pair_median_mean = [ np.median(data.w_k_cell), np.mean(data.w_alpha_cell) ] pair_fit = [res.x[0], res.x[1]] pair_2dmode = get_mode_stats( [np.log10(data.w_k_cell), data.w_alpha_cell]) pair_2dmode[0] = 10**pair_2dmode[0] print("pair_median_mean", pair_median_mean) print("pair_fit", pair_fit) print("pair_2dmode", pair_2dmode) plt.subplot(3, 3, 1) plot_velocity_fit(data) if "vel_fit_error" in data.iloc[0]: plt.text(0.8, 0.8, f'{data.iloc[0]["vel_fit_error"]:.0f}', transform=plt.gca().transAxes) plt.subplot(3, 3, 2) plt.axline([0, 0], slope=1, color="k") plt.plot(data.omega, data.omega_weissenberg, "o", ms=1) plt.xlabel("omega") plt.ylabel("omega weissenberg") plt.subplot(3, 3, 3) plotDensityScatter(data.stress, data.epsilon) plotBinnedData(data.stress, data.epsilon, bins=np.arange(0, 300, 10)) plt.xlabel("stress (Pa)") plt.ylabel("strain") plt.subplot(3, 3, 4) plt.loglog(data.omega_weissenberg, data.w_Gp1, "o", alpha=0.25, ms=1) plt.loglog(data.omega_weissenberg, data.w_Gp2, "o", alpha=0.25, ms=1) xx = [ 10**np.floor(np.log10(np.min(data.w_Gp1))), 10**np.ceil(np.log10(np.max(data.w_Gp1))) ] plt.plot(xx, fit(xx, *pair_fit)[0], "k-", lw=0.8) plt.plot(xx, fit(xx, *pair_fit)[1], "k--", lw=0.8) plt.plot(xx, fit(xx, *pair_median_mean)[0], "r-", lw=0.8) plt.plot(xx, fit(xx, *pair_median_mean)[1], "r--", lw=0.8) plt.plot(xx, fit(xx, *pair_2dmode)[0], "c-", lw=0.8) plt.plot(xx, fit(xx, *pair_2dmode)[1], "c--", lw=0.8) plt.ylabel("G' / G''") plt.xlabel("angular frequency") logk, a = get_mode_stats( [np.log10(data.w_k_cell), data.w_alpha_cell]) plt.subplot(3, 3, 5) plt.cla() plt.xlim(0, 4) plot_density_hist(np.log10(data.w_k_cell), color="C0") plt.axvline(np.log10(pair_fit[0]), color="k") plt.axvline(np.log10(pair_median_mean[0]), color="r") plt.axvline(np.log10(pair_2dmode[0]), color="c") plt.xlabel("log10(k)") plt.ylabel("relative density") plt.text( 0.9, 0.9, f"mean(log10(k)) {np.mean(np.log10(data.w_k_cell)):.2f}\nstd(log10(k)) {np.std(np.log10(data.w_k_cell)):.2f}\nmean(k) {np.mean(data.k_cell):.2f}\nstd(k) {np.std(data.k_cell):.2f}\n", transform=plt.gca().transAxes, va="top", ha="right") plt.subplot(3, 3, 6) plt.cla() plt.xlim(0, 1) plot_density_hist(data.w_alpha_cell, color="C1") plt.xlabel("alpha") plt.axvline(pair_fit[1], color="k") plt.axvline(pair_median_mean[1], color="r") plt.axvline(pair_2dmode[1], color="c") plt.text( 0.9, 0.9, f"mean($\\alpha$) {np.mean(data.w_alpha_cell):.2f}\nstd($\\alpha$) {np.std(data.w_alpha_cell):.2f}\n", transform=plt.gca().transAxes, va="top", ha="right") plt.subplot(3, 3, 7) plt.cla() plotDensityScatter(np.log10(data.w_k_cell), data.w_alpha_cell) plt.axvline(np.log10(pair_fit[0]), color="k") plt.axhline(pair_fit[1], color="k", label="fit") plt.axvline(np.log10(pair_median_mean[0]), color="r") plt.axhline(pair_median_mean[1], color="r", label="median") plt.axvline(np.log10(pair_2dmode[0]), color="c") plt.axhline(pair_2dmode[1], color="c", label="2dmode") plt.legend() print("doublemode", get_mode_stats([np.log10(data.w_k_cell), data.w_alpha_cell])) plt.xlim(1, 3) plt.ylim(0, .5) plt.tight_layout() #plt.plot(data.rp, data.vel) """""" from deformationcytometer.includes.RoscoeCoreInclude import getRatio from deformationcytometer.includes.fit_velocity import getFitXYDot eta0 = data.iloc[0].eta0 alpha = data.iloc[0].delta tau = data.iloc[0].tau pressure = data.iloc[0].pressure def func(x, a, b): return x / 2 * 1 / (1 + a * x**b) def getFitLine(pressure, p): config = { "channel_length_m": 5.8e-2, "channel_width_m": 186e-6 } x, y = getFitXYDot(config, np.mean(pressure), p) return x, y channel_pos, vel_grad = getFitLine(pressure, [eta0, alpha, tau]) vel_grad = -vel_grad vel_grad = vel_grad[channel_pos > 0] channel_pos = channel_pos[channel_pos > 0] omega = func(np.abs(vel_grad), *[0.113, 0.45]) import scipy k_cell, alpha_cell = pair_fit mu1_ = k_cell * omega**alpha_cell * scipy.special.gamma( 1 - alpha_cell) * np.cos(np.pi / 2 * alpha_cell) eta1_ = k_cell * omega**alpha_cell * scipy.special.gamma( 1 - alpha_cell) * np.sin(np.pi / 2 * alpha_cell) / omega ratio, alpha1, alpha2, strain, stress, theta, ttfreq, eta, vdot = getRatio( eta0, alpha, tau, vel_grad, mu1_, eta1_) plt.subplot(3, 3, 3) plt.plot(stress, strain, "-k") k_cell, alpha_cell = pair_median_mean mu1_ = k_cell * omega**alpha_cell * scipy.special.gamma( 1 - alpha_cell) * np.cos(np.pi / 2 * alpha_cell) eta1_ = k_cell * omega**alpha_cell * scipy.special.gamma( 1 - alpha_cell) * np.sin(np.pi / 2 * alpha_cell) / omega ratio, alpha1, alpha2, strain, stress, theta, ttfreq, eta, vdot = getRatio( eta0, alpha, tau, vel_grad, mu1_, eta1_) plt.subplot(3, 3, 3) plt.plot(stress, strain, "-r") k_cell, alpha_cell = pair_2dmode mu1_ = k_cell * omega**alpha_cell * scipy.special.gamma( 1 - alpha_cell) * np.cos(np.pi / 2 * alpha_cell) eta1_ = k_cell * omega**alpha_cell * scipy.special.gamma( 1 - alpha_cell) * np.sin(np.pi / 2 * alpha_cell) / omega ratio, alpha1, alpha2, strain, stress, theta, ttfreq, eta, vdot = getRatio( eta0, alpha, tau, vel_grad, mu1_, eta1_) plt.subplot(3, 3, 3) plt.plot(stress, strain, "-c") self.canvas.draw()
rows = 3 cols = 5 for index, time in enumerate(range(1, 6, 1)): plt.subplot(rows, cols, index + 1) data, config = load_all_data( [ rf"\\131.188.117.96\biophysDS\meroles\2020.07.07.Control.sync\Control2\T{time*10}\*_result.txt", # rf"\\131.188.117.96\biophysDS\meroles\2020.06.26\Control2\T{time*10}\*_result.txt", # rf"\\131.188.117.96\biophysDS\meroles\2020.06.26\Control1\T{time*10}\*_result.txt", # rf"\\131.188.117.96\biophysDS\meroles\2020.07.09_control_sync_hepes\Control3\T{time*10}\*_result.txt", ], repetition=2) plotDensityScatter(data.stress, data.strain) plotStressStrainFit(data, config) for index, time in enumerate(range(2, 11, 2)): plt.subplot(rows, cols, cols + index + 1) data, config = load_all_data( [ rf"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_10_alginate2%_K562_0%FCS_time\{time}\*_result.txt", # rf"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\07_07_2020_alginate2%_rpmi_no_fcs_time\{time}\*_result.txt", ], repetition=2) plotDensityScatter(data.stress, data.strain) plotStressStrainFit(data, config) for index, time in enumerate(range(2, 11, 2)):
position_list = [] for position in ["inlet", "middle", "outlet"]: pressure = 3 data, config = load_all_data([ fr"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_29_aslginate2%_NIH_diff_x_position_2\{position}\[0-9]\*_result.txt", fr"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_29_aslginate2%_NIH_diff_x_position_3\{position}\[0-9]\*_result.txt", ], pressure=pressure) position_list.append([data, config]) for i in range(3): data, config = position_list[i] plt.subplot(2, 3, 1+i) plt.title(["inlet", "middle", "outlet"][i]) plotDensityScatter(np.abs(data.rp), np.log10(data.k_cell), skip=1, y_factor=0.33) plotBinnedData(np.abs(data.rp), np.log10(data.k_cell), np.arange(0, 90, 10), bin_func=np.median, error_func="quantiles") plt.subplot(2, 3, 3+1+i) plotDensityScatter(np.abs(data.rp), data.alpha_cell, skip=1, y_factor=0.33) plotBinnedData(np.abs(data.rp), data.alpha_cell, np.arange(0, 90, 10), bin_func=np.median, error_func="quantiles") #% start: automatic generated code from pylustrator plt.figure(1).ax_dict = {ax.get_label(): ax for ax in plt.figure(1).axes} import matplotlib as mpl plt.figure(1).set_size_inches(16.250000/2.54, 8.000000/2.54, forward=True) plt.figure(1).axes[0].set_xlim(-4.183295591939136, 88.04517013968203) plt.figure(1).axes[0].set_ylim(1.0, 3.0) plt.figure(1).axes[0].set_yticks([1.0, 2.0, 3.0]) plt.figure(1).axes[0].set_xticklabels([])