Skip to content

capwitf/My-MathModeling-skills / math-figure

math-figure

Unverified

Use when 高教社杯/CUMCM 数学建模论文需要规划、选择、审查或修复图、图表、表格转图、图注、图像证据行、正文放置、附录降级或图后结论。

FileKindSize
SKILL.mdskill md4.6 KB
agents/openai.yamlconfig312 B
assets/chart-templates/paper_style.pyscript8.9 KB
assets/high-impact-templates/chart-atlas/atlas-01-bar-charts.pngbinary122.4 KB
assets/high-impact-templates/chart-atlas/atlas-02-line-trends.pngbinary413.7 KB
assets/high-impact-templates/chart-atlas/atlas-03-heatmaps.pngbinary156.1 KB
assets/high-impact-templates/chart-atlas/atlas-04-scatter-bubble.pngbinary473.7 KB
assets/high-impact-templates/chart-atlas/atlas-05-radar-polar.pngbinary615.3 KB
assets/high-impact-templates/chart-atlas/atlas-06-distributions.pngbinary228.3 KB
assets/high-impact-templates/chart-atlas/atlas-07-forest-interval.pngbinary263.8 KB
assets/high-impact-templates/chart-atlas/atlas-08-area-stacked.pngbinary326.9 KB
assets/high-impact-templates/chart-atlas/atlas-09-image-plates.pngbinary350.6 KB
assets/high-impact-templates/chart-atlas/atlas-10-network-matrix.pngbinary304.8 KB
assets/high-impact-templates/figures4papers/assets/Dispersion_motivation.pngbinary818.0 KB
assets/high-impact-templates/figures4papers/assets/Dispersion_observation.pngbinary790.0 KB
assets/high-impact-templates/figures4papers/assets/Dispersion_observation_distillation.pngbinary602.2 KB
assets/high-impact-templates/figures4papers/assets/ImmunoStruct_contrastive.pngbinary490.4 KB
assets/high-impact-templates/figures4papers/assets/ImmunoStruct_results_CEDAR.pngbinary1.2 MB
assets/high-impact-templates/figures4papers/assets/ImmunoStruct_results_IEDB.pngbinary933.9 KB
assets/high-impact-templates/figures4papers/assets/ImmunoStruct_schematic.pngbinary950.1 KB
assets/high-impact-templates/figures4papers/assets/RNAGenScape_schematic.pngbinary976.9 KB
assets/high-impact-templates/figures4papers/figure_CellSpliceNet/figures/ablation.pngbinary347.0 KB
assets/high-impact-templates/figures4papers/figure_CellSpliceNet/figures/comparison.pngbinary794.0 KB
assets/high-impact-templates/figures4papers/figure_CellSpliceNet/figures/comparison_human.pngbinary860.2 KB
assets/high-impact-templates/figures4papers/figure_CellSpliceNet/figures/comparison_worm.pngbinary903.6 KB
assets/high-impact-templates/figures4papers/figure_CellSpliceNet/plot_ablation.pyscript2.9 KB
assets/high-impact-templates/figures4papers/figure_CellSpliceNet/plot_comparison.pyscript3.8 KB
assets/high-impact-templates/figures4papers/figure_CellSpliceNet/plot_comparison_cross_species.pyscript6.4 KB
assets/high-impact-templates/figures4papers/figure_Cflows/diffusion_swiss_roll.pyscript3.5 KB
assets/high-impact-templates/figures4papers/figure_Cflows/figures/diffusion_swiss_roll.pngbinary1.7 MB
assets/high-impact-templates/figures4papers/figure_Cflows/figures/fig2_comparison_GeneRegulatory.pdfbinary24.2 KB
assets/high-impact-templates/figures4papers/figure_Cflows/figures/fig2_comparison_GeneRegulatory.pngbinary280.7 KB
assets/high-impact-templates/figures4papers/figure_Cflows/figures/fig2_comparison_Trajectory.pdfbinary19.3 KB
assets/high-impact-templates/figures4papers/figure_Cflows/figures/fig2_comparison_Trajectory.pngbinary379.2 KB
assets/high-impact-templates/figures4papers/figure_Cflows/figures/figX_comparison_Ablation.pdfbinary18.8 KB
assets/high-impact-templates/figures4papers/figure_Cflows/figures/figX_comparison_Ablation.pngbinary321.2 KB
assets/high-impact-templates/figures4papers/figure_Cflows/plot_comparison_Ablation.pyscript2.4 KB
assets/high-impact-templates/figures4papers/figure_Cflows/plot_comparison_GeneRegulatory.pyscript3.0 KB
assets/high-impact-templates/figures4papers/figure_Cflows/plot_comparison_Trajectory.pyscript2.9 KB
assets/high-impact-templates/figures4papers/figure_Dispersion/figures/idea.pngbinary375.8 KB
assets/high-impact-templates/figures4papers/figure_Dispersion/figures/illustration.pngbinary745.1 KB
assets/high-impact-templates/figures4papers/figure_Dispersion/plot_idea.pyscript2.4 KB
assets/high-impact-templates/figures4papers/figure_Dispersion/plot_illustration.pyscript15.1 KB
assets/high-impact-templates/figures4papers/figure_FPGM/figures/freq_prior.pngbinary626.0 KB
assets/high-impact-templates/figures4papers/figure_FPGM/plot_freq_prior.pyscript6.4 KB
assets/high-impact-templates/figures4papers/figure_ImmunoStruct/figures/bars_ablation_Cancer.pngbinary797.6 KB
assets/high-impact-templates/figures4papers/figure_ImmunoStruct/figures/bars_ablation_IEDB.pngbinary1.1 MB
assets/high-impact-templates/figures4papers/figure_ImmunoStruct/figures/bars_comparison_Cancer.pngbinary781.0 KB
assets/high-impact-templates/figures4papers/figure_ImmunoStruct/figures/bars_comparison_IEDB.pngbinary739.8 KB
assets/high-impact-templates/figures4papers/figure_ImmunoStruct/plot_bars.pyscript7.5 KB
assets/high-impact-templates/figures4papers/figure_ImmunoStruct/raw_data.pyscript4.4 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/figures/manifold.pngbinary105.7 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/figures/manifold_holes.pngbinary996.0 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/figures/results_comparison_optimization.pngbinary830.5 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/figures/results_comparison_speed.pngbinary90.2 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/figures/results_sweep.pngbinary138.8 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/plot_comparison.pyscript11.0 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/plot_hole_manifold.pyscript2.5 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/plot_manifold.pyscript1.8 KB
assets/high-impact-templates/figures4papers/figure_RNAGenScape/plot_sweep.pyscript2.8 KB
assets/high-impact-templates/figures4papers/figure_VIGIL/figures/ablation_curves.pngbinary586.6 KB
assets/high-impact-templates/figures4papers/figure_VIGIL/figures/comparison_posttraining.pngbinary243.4 KB
assets/high-impact-templates/figures4papers/figure_VIGIL/figures/comparison_radar.pngbinary790.9 KB
assets/high-impact-templates/figures4papers/figure_VIGIL/figures/concept.pngbinary1.6 MB
assets/high-impact-templates/figures4papers/figure_VIGIL/plot_ablation.pyscript5.9 KB
assets/high-impact-templates/figures4papers/figure_VIGIL/plot_comparison_radar.pyscript7.2 KB
assets/high-impact-templates/figures4papers/figure_VIGIL/plot_concept.pyscript9.0 KB
assets/high-impact-templates/figures4papers/figure_VIGIL/plot_posttraining.pyscript2.9 KB
assets/high-impact-templates/figures4papers/figure_brainteaser/figures/brute_force.pngbinary1.7 MB
assets/high-impact-templates/figures4papers/figure_brainteaser/figures/correctness_by_category.pngbinary640.1 KB
assets/high-impact-templates/figures4papers/figure_brainteaser/figures/correctness_by_subcategory.pngbinary1.0 MB
assets/high-impact-templates/figures4papers/figure_brainteaser/figures/rewriting.pngbinary400.5 KB
assets/high-impact-templates/figures4papers/figure_brainteaser/figures/selfcorrection_math.pngbinary597.2 KB
assets/high-impact-templates/figures4papers/figure_brainteaser/plot_brute_force.pyscript9.9 KB
assets/high-impact-templates/figures4papers/figure_brainteaser/plot_correctness_by_category.pyscript6.3 KB
assets/high-impact-templates/figures4papers/figure_brainteaser/plot_correctness_by_subcategory.pyscript6.4 KB
assets/high-impact-templates/figures4papers/figure_brainteaser/plot_rewriting.pyscript3.6 KB
assets/high-impact-templates/figures4papers/figure_brainteaser/plot_selfcorrection_math.pyscript3.9 KB
assets/high-impact-templates/figures4papers/figure_ophthal_review/figures/composition_heatmap.pngbinary273.0 KB
assets/high-impact-templates/figures4papers/figure_ophthal_review/figures/trend_by_month.pngbinary355.6 KB
assets/high-impact-templates/figures4papers/figure_ophthal_review/plot_composition.pyscript3.0 KB
assets/high-impact-templates/figures4papers/figure_ophthal_review/plot_trend.pyscript5.4 KB
references/chart-template-index.mdmarkdown4.5 KB
references/contest-chart-selection.mdmarkdown2.5 KB
references/contest-figure-pitfalls.mdmarkdown2.0 KB
references/high-impact-chart-assets.mdmarkdown4.2 KB
references/paper-figure-style.mdmarkdown2.4 KB
references/selection-guide.mdmarkdown3.0 KB
references/visual-readiness-loop.mdmarkdown1.7 KB
scripts/check_contest_figure.pyscript3.0 KB
scripts/profile_result_table.pyscript3.8 KB

assets/chart-templates/paper_style.py

View on GitHub
from __future__ import annotations

from collections.abc import Iterable
from pathlib import Path

import matplotlib.pyplot as plt


PALETTE = {
    "blue_main": "#0F4D92",
    "blue_secondary": "#3775BA",
    "green_1": "#DDF3DE",
    "green_2": "#AADCA9",
    "green_3": "#8BCF8B",
    "red_1": "#F6CFCB",
    "red_2": "#E9A6A1",
    "red_strong": "#B64342",
    "neutral_light": "#CFCECE",
    "neutral_mid": "#767676",
    "neutral_dark": "#4D4D4D",
    "neutral_black": "#272727",
    "gold": "#FFD700",
    "teal": "#42949E",
    "violet": "#9A4D8E",
    "magenta": "#EA84DD",
}

DEFAULT_COLORS = [
    PALETTE["blue_main"],
    PALETTE["green_3"],
    PALETTE["red_strong"],
    PALETTE["teal"],
    PALETTE["violet"],
    PALETTE["neutral_light"],
]

CONTEST_PAPER_COLORS = {
    "main_text": "#1F2933",
    "muted_text": "#5B6770",
    "axis": "#8A949E",
    "grid": "#E6E8EB",
    "accent_blue": "#4E79A7",
    "accent_orange": "#F28E2B",
    "accent_teal": "#59A14F",
    "accent_red": "#D95F5F",
    "accent_purple": "#8C6BB1",
    "neutral_fill": "#F7F8FA",
}

CONTEST_PAPER_SERIES = [
    CONTEST_PAPER_COLORS["accent_blue"],
    CONTEST_PAPER_COLORS["accent_orange"],
    CONTEST_PAPER_COLORS["accent_teal"],
    CONTEST_PAPER_COLORS["accent_red"],
    CONTEST_PAPER_COLORS["accent_purple"],
]


def apply_publication_style(font_size: int = 9, axes_linewidth: float = 0.8, use_tex: bool = False) -> None:
    configure_paper_matplotlib()
    plt.rcParams.update(
        {
            "font.family": "sans-serif",
            "font.sans-serif": ["Arial", "Helvetica", "DejaVu Sans", "Microsoft YaHei", "SimSun"],
            "svg.fonttype": "none",
            "pdf.fonttype": 42,
            "font.size": font_size,
            "axes.linewidth": axes_linewidth,
            "legend.frameon": False,
            "text.usetex": use_tex,
        }
    )


def configure_paper_matplotlib() -> None:
    plt.rcParams.update(
        {
            "figure.facecolor": "white",
            "axes.facecolor": "white",
            "axes.edgecolor": CONTEST_PAPER_COLORS["axis"],
            "axes.labelcolor": CONTEST_PAPER_COLORS["main_text"],
            "xtick.color": CONTEST_PAPER_COLORS["muted_text"],
            "ytick.color": CONTEST_PAPER_COLORS["muted_text"],
            "text.color": CONTEST_PAPER_COLORS["main_text"],
            "font.family": ["SimSun", "Microsoft YaHei", "DejaVu Serif"],
            "axes.unicode_minus": False,
            "svg.fonttype": "none",
            "pdf.fonttype": 42,
            "savefig.dpi": 300,
            "savefig.bbox": "tight",
        }
    )


def apply_paper_style(ax, *, grid_axis: str = "y", hide_top_right: bool = True) -> None:
    ax.grid(axis=grid_axis, color=CONTEST_PAPER_COLORS["grid"], linewidth=0.6)
    ax.set_axisbelow(True)
    if hide_top_right:
        ax.spines["top"].set_visible(False)
        ax.spines["right"].set_visible(False)
    for side in ["left", "bottom"]:
        ax.spines[side].set_color(CONTEST_PAPER_COLORS["axis"])
        ax.spines[side].set_linewidth(0.8)
    ax.tick_params(axis="both", colors=CONTEST_PAPER_COLORS["muted_text"], labelsize=9)
    ax.title.set_visible(False)


def add_panel_label(
    ax,
    label: str,
    *,
    x: float = -0.06,
    y: float = 1.02,
    fontsize: int = 12,
    color: str | None = None,
    fontweight: str = "bold",
) -> None:
    ax.text(
        x,
        y,
        label,
        transform=ax.transAxes,
        fontsize=fontsize,
        fontweight=fontweight,
        color=color or CONTEST_PAPER_COLORS["main_text"],
        ha="left",
        va="bottom",
    )


def style_dark_image_ax(ax, *, facecolor: str = "black") -> None:
    ax.set_facecolor(facecolor)
    ax.set_xticks([])
    ax.set_yticks([])
    for spine in ax.spines.values():
        spine.set_visible(False)


def get_series_colors(count: int) -> list[str]:
    if count <= 0:
        return []
    repeated: Iterable[str] = (
        CONTEST_PAPER_SERIES[index % len(CONTEST_PAPER_SERIES)]
        for index in range(count)
    )
    return list(repeated)


def make_grouped_bar(
    ax,
    categories,
    series,
    labels,
    *,
    ylabel: str = "Value",
    colors: list[str] | None = None,
    annotate: bool = False,
    bar_width: float = 0.8,
):
    import numpy as np

    colors = colors or get_series_colors(len(series))
    n_groups = len(series)
    x = np.arange(len(categories))
    width = bar_width / max(n_groups, 1)
    containers = []
    for index, (values, label, color) in enumerate(zip(series, labels, colors)):
        offset = (index - (n_groups - 1) / 2) * width
        bars = ax.bar(
            x + offset,
            values,
            width=width,
            label=label,
            color=color,
            edgecolor="white",
            linewidth=0.8,
        )
        containers.append(bars)
        if annotate:
            for bar, value in zip(bars, values):
                ax.text(
                    bar.get_x() + bar.get_width() / 2,
                    bar.get_height(),
                    f"{value:.2f}",
                    ha="center",
                    va="bottom",
                    fontsize=8,
                )
    ax.set_xticks(x)
    ax.set_xticklabels(categories)
    ax.set_ylabel(ylabel)
    apply_paper_style(ax)
    ax.legend(frameon=False)
    return containers


def make_trend(
    ax,
    x,
    y_series,
    labels,
    *,
    colors: list[str] | None = None,
    ylabel: str | None = None,
    xlabel: str | None = None,
    show_shadow: bool = False,
    shadow_alpha: float = 0.15,
    linewidth: float = 1.8,
    marker: str = "o",
):
    import numpy as np

    colors = colors or get_series_colors(len(y_series))
    for values, label, color in zip(y_series, labels, colors):
        array = np.asarray(values)
        if array.ndim == 2:
            mean = array.mean(axis=0)
            std = array.std(axis=0)
        else:
            mean = array
            std = None
        ax.plot(x, mean, color=color, linewidth=linewidth, marker=marker, label=label)
        if show_shadow and std is not None:
            ax.fill_between(x, mean - std, mean + std, color=color, alpha=shadow_alpha)
    if ylabel:
        ax.set_ylabel(ylabel)
    if xlabel:
        ax.set_xlabel(xlabel)
    apply_paper_style(ax)
    ax.legend(frameon=False)


def make_heatmap(
    ax,
    matrix,
    *,
    x_labels=None,
    y_labels=None,
    cmap: str = "viridis",
    cbar_label: str | None = None,
    annotate: bool = False,
    fmt: str = "{:.2f}",
):
    import numpy as np

    image = ax.imshow(matrix, cmap=cmap, aspect="auto")
    if cbar_label:
        colorbar = ax.figure.colorbar(image, ax=ax)
        colorbar.set_label(cbar_label)
    if x_labels is not None:
        ax.set_xticks(range(len(x_labels)))
        ax.set_xticklabels(x_labels, rotation=30, ha="right")
    if y_labels is not None:
        ax.set_yticks(range(len(y_labels)))
        ax.set_yticklabels(y_labels)
    if annotate:
        values = np.asarray(matrix)
        midpoint = (np.nanmin(values) + np.nanmax(values)) / 2
        for (row, col), value in np.ndenumerate(values):
            ax.text(
                col,
                row,
                fmt.format(value),
                ha="center",
                va="center",
                fontsize=8,
                color="white" if value < midpoint else CONTEST_PAPER_COLORS["main_text"],
            )
    ax.set_frame_on(False)
    ax.title.set_visible(False)
    return image


def make_forest_plot(
    ax,
    labels,
    estimates,
    ci_low,
    ci_high,
    *,
    colors: list[str] | None = None,
    ref: float = 0.0,
    xlabel: str | None = None,
):
    import numpy as np

    y_positions = np.arange(len(labels))[::-1]
    colors = colors or [CONTEST_PAPER_COLORS["accent_red"]] * len(labels)
    for y, estimate, low, high, color in zip(y_positions, estimates, ci_low, ci_high, colors):
        ax.plot([low, high], [y, y], color=color, linewidth=1.5)
        ax.plot(estimate, y, marker="o", markersize=5, color=color)
    ax.axvline(ref, color=CONTEST_PAPER_COLORS["muted_text"], linestyle="--", linewidth=1.0)
    ax.set_yticks(y_positions)
    ax.set_yticklabels(labels)
    if xlabel:
        ax.set_xlabel(xlabel)
    apply_paper_style(ax, grid_axis="x")


def finalize_figure(
    fig,
    output_base: str | Path,
    *,
    formats: list[str] | None = None,
    dpi: int = 300,
    close: bool = True,
) -> list[Path]:
    base = Path(output_base)
    if formats is None:
        if base.suffix:
            formats = [base.suffix.lstrip(".")]
            base = base.with_suffix("")
        else:
            formats = ["svg", "pdf", "png"]
    base.parent.mkdir(parents=True, exist_ok=True)
    fig.tight_layout()
    paths: list[Path] = []
    for fmt in formats:
        path = base.with_suffix(f".{fmt}")
        save_kwargs = {"bbox_inches": "tight"}
        if fmt.lower() in {"png", "tif", "tiff", "jpg", "jpeg"}:
            save_kwargs["dpi"] = dpi
        fig.savefig(path, **save_kwargs)
        paths.append(path)
    if close:
        plt.close(fig)
    return paths
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall