Beispiel #1
0
    def __init__(self, rename=True, invert=False, **params):
        # todo from_spec constructor method for this kind of logic
        cmap = params.pop("cmap", None)
        cmap = pplt.Colormap(cmap) if cmap else cmap
        params["cmap"] = cmap
        super().__init__(**params)
        self._excluded_from_opts += [
            "norm",
            "sclf",
        ]  # perhaps use leading underscore to exclude?

        if self.cmap is None and self.norm is None and self.field is not None:
            cmap, norm = CMAP_NORM_DEFAULTS[self.field]
        elif self.field is None:
            cmap = pplt.Colormap("viridis")
            norm = pplt.Norm("linear", 0.0, 1.0)

        self.norm = norm
        self._cmap = cmap  # unreversed cmap

        if rename:
            cmap.name = self.field + "_default"
        if invert:
            cmap = cmap.reversed()

        self.cmap = cmap
Beispiel #2
0
from concurrent import futures
import proplot as pplt

current_dir = Path().cwd()
fit_result = load_fitresult(current_dir / 'output' /
                            'SecB_tetramer_dimer_batch')

tmp_dir = Path(__file__).parent / 'temp'
tmp_dir.mkdir(exist_ok=True)

if __name__ == '__main__':

    report = FitReport(fit_result, temp_dir=tmp_dir)
    report.add_standard_figure('peptide_coverage_figure')
    report.add_standard_figure('residue_time_scatter_figure')
    report.add_standard_figure('residue_scatter_figure')
    report.add_standard_figure('dG_scatter_figure', ncols=1, aspect=3)
    report.add_standard_figure('ddG_scatter_figure', ncols=1, reference=0)
    report.add_standard_figure('linear_bars',
                               cmap='viridis',
                               norm=pplt.Norm('linear', 15e3,
                                              35e3))  #todo name from kwargs
    report.add_standard_figure('rainbowclouds')

    report.add_peptide_uptake_curves()

    executor = futures.ProcessPoolExecutor(max_workers=10)
    report.generate_figures(executor=executor)

    report.generate_latex()
    report.generate_pdf(current_dir / 'output' / 'fit_report')
Beispiel #3
0
data2 = (state.rand(20, 20) - 0.515).cumsum(axis=0).cumsum(axis=1)

# Figure
fig, axs = pplt.subplots(nrows=2, ncols=2, refwidth=2.2, order='F')
axs.format(suptitle='Diverging normalizer demo')
cmap = pplt.Colormap('DryWet', cut=0.1)

# Diverging norms
i = 0
for data, mode, fair in zip(
    (data1, data2),
    ('positive', 'negative'),
    ('fair', 'unfair'),
):
    for fair in ('fair', 'unfair'):
        norm = pplt.Norm('diverging', fair=(fair == 'fair'))
        ax = axs[i]
        m = ax.contourf(data, cmap=cmap, norm=norm)
        ax.colorbar(m, loc='b')
        ax.format(title=f'{mode.title()}-skewed + {fair} scaling')
        i += 1

# %% [raw] raw_mimetype="text/restructuredtext"
# .. _ug_discrete:
#
# Discrete levels
# ---------------
#
# By default, proplot uses `~proplot.colors.DiscreteNorm` to "discretize"
# the possible colormap colors for contour and pseudocolor `~proplot.axes.PlotAxes`
# commands (e.g., `~proplot.axes.PlotAxes.contourf`, `~proplot.axes.PlotAxes.pcolor`).