def plot_times(ax, name, **kwargs): f = kwargs.pop('value_prefactor', 1.) colors = 'rgbmk' markers = 'os<>d' for i, t in enumerate(times): avg, std = radial[name, t] avg, std = avg[mask], std[mask] #ax.errorbar(bins[mask], f*avg, yerr=f*std, label = 't = %s' % f2s(t), **kwargs) mpl_utils.errorbar(ax, bins[mask], f * avg, yerr=f * std, label='t = $%s$' % f2s(t), marker=markers[i], color=colors[i], every=5, **kwargs)
def plot(ax, name, scalefactor=1., label=None, colors=default_colors, errorbars=True, zero_ylim=True): for color, i, (time, tumor_radius, curves) in itertools.izip(itertools.cycle(colors), itertools.count(), snapshotlist): curve = myutils.MeanValueArray.fromSummation( map(lambda x: x.avg, curves[name])) label = FmtTime(time) mask = ~curve.avg.mask if errorbars: mpl_utils.errorbar(ax, bins[mask], scalefactor * curve.avg[mask], yerr=scalefactor * curve.std_mean[mask], label=label, marker=None, color=color, every=2) else: ax.plot(bins[mask], scalefactor * curve.avg[mask], label=label, color=colors[i]) if zero_ylim: _, ymax = ax.get_ylim() ax.set_ylim((0., ymax)) if measurementinfo['distancemap_spec'] == 'levelset': ax.set(xlim=(-2., 2.)) mpl_utils.add_crosshair(ax, (0., None), ls=':') else: mpl_utils.add_crosshair(ax, (0.5e-3 * world_size[0], None)) ax.set(xlim=(0, 0.5e-3 * world_size[0])) for color, i, (time, tumor_radius, curves) in itertools.izip(itertools.cycle(colors), itertools.count(), snapshotlist): mpl_utils.add_crosshair(ax, (tumor_radius * 1.e-3, None), ls=':', color=color)
def plt_rad(ax): ax.set(ylabel='[mm]', xlabel='t [h]') mpl_utils.errorbar(ax, times, 1.e-3 * radius, yerr=1.e-3 * radius_std, label='r', lw=0., marker='x', color='k', markersize=5.) label = u'$r_0 + v_{fit} t$\n$v_{fit} = %s$ [\u03BCm/h]' % f2s( velocity) ax.plot(times, 1.e-3 * (p[1] + p[0] * times), label=label, color='r') ax.legend()
def plot(ax, name, scalefactor=1., label=None, colors=default_colors, errorbars=True, zero_ylim=True): for i, path in enumerate(pathorder): curve = curves_by_path_and_name[path, name] label = labels_by_path[path] if label else None mask = ~curve.avg.mask if errorbars: mpl_utils.errorbar(ax, bins[mask], scalefactor * curve.avg[mask], yerr=scalefactor * curve.std_mean[mask], label=label, marker=None, color=colors[i], every=2) else: ax.plot(bins[mask], scalefactor * curve.avg[mask], label=label, color=colors[i]) if zero_ylim: _, ymax = ax.get_ylim() ax.set_ylim((0., ymax)) if distance_distribution_name == 'levelset': ax.set(xlim=(-2., 2.)) mpl_utils.add_crosshair(ax, (0., None), ls=':') else: ax.set(xlim=(0., rmax)) for i, path in enumerate(pathorder): mpl_utils.add_crosshair( ax, (curves_by_path_and_name[path, 'approximate_tumor_radius'].avg * 1.e-3, None), ls=':')
def plot(name, **kwargs): f = kwargs.pop('value_prefactor', 1.) avg, std = radial[name] avg, std = avg[mask], std[mask] kwargs.update(every=5, marker=kwargs.pop('marker', 's'), color=kwargs.pop('color', 'k')) ret = mpl_utils.errorbar(ax, bins[mask], f * avg, yerr=f * std, **kwargs) return ret