Skip to content

VIZ format table cells with markers - #993

Open
etyl wants to merge 2 commits into
benchopt:mainfrom
etyl:VIZ_format_table_cells
Open

VIZ format table cells with markers#993
etyl wants to merge 2 commits into
benchopt:mainfrom
etyl:VIZ_format_table_cells

Conversation

@etyl

@etyl etyl commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Table cells can now be formatted with some simple markers (bold, italic and underlines), works with text and numbers. This is useful when we want to highlight the best results in a table for example.

Checks before merging PR

  • added documentation for any new feature
  • added unit test
  • edited the what's new (if applicable)

@etyl

etyl commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

An example:
image

Generated with:

from benchopt import BasePlot


class Plot(BasePlot):
    name = "Custom table"
    type = "table"
    options = {
        "dataset": ...,
    }

    def plot(self, df, dataset):
        df = df[df['dataset_name'] == dataset]
        # Last value reached by each solver, median over the repetitions
        results = (
            df.select_dtypes(include=['number'])
            .join(df['solver_name'])
            .groupby(['solver_name', 'stop_val'])
            .median()
            .groupby('solver_name')
            .last()
        )
        best = results['objective_value'].idxmin()

        return [
            [
                f"**{solver}**" if solver == best else solver,
                f"**{res['objective_value']}**" if solver == best else res['objective_value'],
                res['time'],
                "__best objective__" if solver == best else r"*runner-up\**",
            ]
            for solver, res in results.iterrows()
        ]

    def get_metadata(self, df, dataset):
        return {
            "title": f"Custom table\nData: {dataset}",
            "columns": ["solver", "objective_value", "time (s)", "comment"],
            "default_order_column": "objective_value",
            "default_order_ascending": True,
        }

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.75%. Comparing base (3192a5e) to head (bc1ea03).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #993   +/-   ##
=======================================
  Coverage   87.75%   87.75%           
=======================================
  Files          56       56           
  Lines        4581     4581           
=======================================
  Hits         4020     4020           
  Misses        561      561           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@etyl

etyl commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

What do you think @tomMoral ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant