Worked Examples

Create accessible scientific figures — Visualization & Graphing

Create accessible scientific figures — Visualization & Graphing Cross-application area: Visualization & Graphing Status: Initial scientific graphics guidance; platform-specific features not verified. Goal Provide legible visual en

ProductSustainable Catalyst Research LabUpdatedNovember 14, 2026Reading time1 minutes

Product: Sustainable Catalyst Research Lab
Category: Worked Examples
Cross-application area: Visualization & Graphing
Difficulty: Intermediate
Example technology: Python, pandas, Plotly
Data: Synthetic demonstration dataset
Status: Reference workflow — platform verification pending

1. Learning Objective

This worked example demonstrates how to create a scientific figure
that is numerically accurate, visually legible, accessible to readers
with different abilities, and reproducible from its source data.

By completing the example, you will be able to:

  • Prepare and validate a scientific dataset before visualization.
  • Build an interactive scientific figure using Python and Plotly.
  • Represent multiple data series using both color and visual patterns.
  • Label axes, units, legends, and scientific context correctly.
  • Provide accessible text and tabular alternatives.
  • Check plotted values against their authoritative source.
  • Export the figure while retaining a reproducibility record.
  • Identify the additional checks needed before publication.

Success criterion: A reader can recover the essential
comparisons and numerical findings without relying on color alone
or interacting with the chart.

2. Scientific Scenario

Consider a hypothetical research experiment investigating how a
treatment changes a measured environmental response over time.
The study contains two groups:

  • Control: Measurements without the treatment.
  • Treatment: Measurements after the experimental intervention.

Each group has measurements at four observation times.
The purpose of the figure is to compare changes over time
and make differences between the two groups understandable.

The example uses a generic response variable expressed in
arbitrary units (a.u.). It does not represent actual experimental
observations or a verified environmental effect.

2.1 Example Dataset

Synthetic experimental response measurements
Day Control (a.u.) Treatment (a.u.)
0 10.0 10.0
7 10.5 12.0
14 10.8 14.5
21 11.0 16.0

Scientific question: How does the measured response
change over the observation period in the treatment group compared
with the control group?

The dataset is deliberately small so that every plotted value can
be inspected directly. It contains no uncertainty measurements,
replicate counts, or statistical test results. Consequently, it
cannot establish statistical significance or treatment efficacy.

3. Prepare the Computing Environment

The example requires a Python environment with pandas and Plotly.
pytest is used for the optional automated verification step.

python3 -m venv .venv

source .venv/bin/activate

python -m pip install pandas plotly pytest

These commands illustrate a local development workflow.
Package availability and versions depend on the execution environment.
For research-grade reproducibility, record the resolved versions
and use a reviewed, pinned dependency file or lockfile.

Within a Sustainable Catalyst environment, use an approved
notebook or computational workspace only after confirming that
the required Python packages and artifact-export capabilities
are supported.

4. Create and Validate the Dataset

Begin by constructing a DataFrame with explicit column names
and numeric observations.

import pandas as pd

data = pd.DataFrame({
    "day": [0, 7, 14, 21],
    "control": [10.0, 10.5, 10.8, 11.0],
    "treatment": [10.0, 12.0, 14.5, 16.0]
})

required_columns = [
    "day",
    "control",
    "treatment"
]

assert all(
    column in data.columns
    for column in required_columns
)

assert not data[required_columns].isna().any().any()

assert data["day"].is_monotonic_increasing

assert data["day"].is_unique

assert all(
    pd.api.types.is_numeric_dtype(data[column])
    for column in required_columns
)

import numpy as np

assert np.isfinite(
    data[required_columns].to_numpy(dtype=float)
).all()

print(data)

This validation confirms that the necessary columns exist,
observations are numeric and finite, missing values are absent,
and observation times are unique and ordered.

Real datasets require additional validation for measurement
units, source provenance, missing-data policies, sampling
methods, uncertainty, and applicable scientific assumptions.

5. Construct an Accessible Scientific Figure

Use Plotly to generate a line chart with distinguishable
line patterns and markers.

The control group uses circles and a solid line.
The treatment group uses diamonds and a dashed line.
These distinctions provide additional visual information
beyond color.

import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(
    go.Scatter(
        x=data["day"],
        y=data["control"],
        mode="lines+markers",
        name="Control",
        line={
            "color": "#2463A6",
            "width": 3,
            "dash": "solid"
        },
        marker={
            "symbol": "circle",
            "size": 10
        },
        hovertemplate=(
            "Control<br>"
            "Day: %{x}<br>"
            "Response: %{y:.1f} a.u."
            "<extra></extra>"
        )
    )
)

fig.add_trace(
    go.Scatter(
        x=data["day"],
        y=data["treatment"],
        mode="lines+markers",
        name="Treatment",
        line={
            "color": "#A52A2A",
            "width": 3,
            "dash": "dash"
        },
        marker={
            "symbol": "diamond",
            "size": 10
        },
        hovertemplate=(
            "Treatment<br>"
            "Day: %{x}<br>"
            "Response: %{y:.1f} a.u."
            "<extra></extra>"
        )
    )
)

fig.update_layout(
    title={
        "text": "Experimental Response Over Time",
        "x": 0.5
    },
    xaxis_title="Observation time (days)",
    yaxis_title="Measured response (a.u.)",
    template="plotly_white",
    legend_title="Experimental group",
    font={"size": 15},
    hovermode="x unified",
    margin={
        "l": 80,
        "r": 40,
        "t": 90,
        "b": 80
    }
)

fig.update_xaxes(
    tickvals=[0, 7, 14, 21],
    showgrid=True
)

fig.update_yaxes(
    rangemode="tozero",
    showgrid=True
)

fig.show()

5.1 Expected Visual Result

The generated figure should contain two clearly identified series.
The control group increases slightly from 10.0 to 11.0 a.u.,
while the treatment group increases from 10.0 to 16.0 a.u.

The treatment series should remain distinguishable from
the control series through its dashed line and diamond markers,
even when color distinctions are difficult to perceive.

The connecting lines are a visual aid between discrete
measurements. They must not be interpreted as additional
observations or evidence of continuous measurement.

6. Add Accessible Descriptions

A chart’s title and axis labels are necessary but do not
provide all information required for accessibility.

Prepare a concise alternative description summarizing the
purpose, principal trend, and essential comparison.

6.1 Suggested Alternative Text

Line chart comparing control and treatment measurements
over 21 days. Both groups begin at 10.0 arbitrary units.
The control increases to 11.0, while the treatment increases
to 16.0. The treatment series is shown with a dashed line
and diamond markers; the control uses a solid line and circles.

6.2 Suggested Scientific Caption

Figure 1. Synthetic experimental response
measurements for control and treatment groups at days
0, 7, 14, and 21. Values represent illustrative measurements
in arbitrary units. Connecting lines aid comparison between
observation times; no interpolated values or uncertainty
estimates are implied. Data are synthetic and should not
be interpreted as empirical evidence.

Avoid descriptions that merely repeat the chart title.
The alternative description should communicate essential
information that readers might otherwise obtain visually.

7. Provide an Equivalent Data Table

A structured table enables users to inspect exact numerical
observations independently of the chart.

Export the underlying dataset as CSV:

data.to_csv(
    "accessible_scientific_figure_data.csv",
    index=False
)

When publishing to HTML, provide the same observations in
a semantic table with a caption and column headers.
The table in Section 2.1 demonstrates this structure.

A CSV download is useful for reuse, but it should not be
the only accessible alternative. Provide meaningful text
and, where necessary, an HTML table directly within the
publication or its accessible supporting material.

8. Verify the Scientific Interpretation

Before exporting, calculate the essential comparison
directly from the dataset.

control_change = (
    data["control"].iloc[-1]
    - data["control"].iloc[0]
)

treatment_change = (
    data["treatment"].iloc[-1]
    - data["treatment"].iloc[0]
)

final_difference = (
    data["treatment"].iloc[-1]
    - data["control"].iloc[-1]
)

print("Control change:", control_change)
print("Treatment change:", treatment_change)
print("Final difference:", final_difference)

assert abs(control_change - 1.0) < 1e-12
assert abs(treatment_change - 6.0) < 1e-12
assert abs(final_difference - 5.0) < 1e-12

8.1 Expected Results

Verified calculations for the synthetic dataset
Metric Expected Value
Control change +1.0 a.u.
Treatment change +6.0 a.u.
Difference between groups at day 21 5.0 a.u.

These calculations are deterministic for the supplied
synthetic values. They do not establish causality or
statistical significance.

8.2 Compare the Figure Against Its Source

Validate the chart traces directly, rather than relying
exclusively on visual inspection.

import numpy as np

assert len(fig.data) == 2

np.testing.assert_allclose(
    fig.data[0].y,
    data["control"].to_numpy()
)

np.testing.assert_allclose(
    fig.data[1].y,
    data["treatment"].to_numpy()
)

np.testing.assert_allclose(
    fig.data[0].x,
    data["day"].to_numpy()
)

np.testing.assert_allclose(
    fig.data[1].x,
    data["day"].to_numpy()
)

This confirms that the Plotly figure contains the expected
numerical values before export.

9. Export the Figure

Export an interactive HTML visualization:

fig.write_html(
    "accessible_scientific_figure.html",
    include_plotlyjs=True,
    full_html=True
)

The resulting file contains the interactive Plotly figure.
It does not automatically include the full accessible
HTML table, explanatory narrative, or all publication
accessibility requirements.

For publication, embed or assemble the chart within an
accessible document that includes the required description,
caption, and data alternative.

9.1 Static Figure Export

If a compatible Plotly static-image export engine is installed,
generate an SVG figure:

python -m pip install kaleido
fig.write_image(
    "accessible_scientific_figure.svg"
)

Static export compatibility depends on the installed
Plotly, Kaleido, and browser environment versions.
Inspect the exported SVG for missing labels, layout changes,
and preservation of the expected numerical representation.

An SVG export does not automatically provide meaningful
alternative text or complete accessibility. Supply these
through the publication context or through a separately
validated accessible document.

10. Accessibility Validation

Perform both automated and manual accessibility checks.
A figure should not be declared accessible solely because
its lines use different colors or it contains an
alternative description.

10.1 Visual Inspection

  • Confirm each series has distinguishable markers or line patterns.
  • Ensure axis labels and units remain legible.
  • Check that the legend identifies each series unambiguously.
  • Review contrast of lines, markers, text, and graphical elements.
  • Inspect the figure under grayscale or color-vision simulations.
  • Verify that resizing does not hide essential information.
  • Check for overlapping labels, clipped legends, and missing data marks.

10.2 Keyboard and Assistive Technology

  • Test keyboard navigation in the published HTML context.
  • Confirm all essential interactive actions have accessible alternatives.
  • Verify that keyboard focus remains visible and does not become trapped.
  • Check that essential values are not available exclusively through mouse hover.
  • Review title, description, and table relationships with a screen reader.
  • Confirm the publication’s accessible alternatives remain available when chart interaction is unavailable.

10.3 Standards

Evaluate relevant requirements of the Web Content
Accessibility Guidelines (WCAG) 2.2, including use of
color, non-text contrast, keyboard accessibility,
text alternatives, and meaningful structure.

Automated tools such as axe-core may identify some accessibility
problems, but manual and assistive-technology testing remain
necessary.

11. Reproducibility Record

Scientific visualizations should be reproducible from
identifiable source data and documented processing steps.

Record the source file checksum and software versions
associated with the exported figure.

import hashlib
import json
from pathlib import Path

import pandas
import plotly

source_file = Path(
    "accessible_scientific_figure_data.csv"
)

source_hash = hashlib.sha256(
    source_file.read_bytes()
).hexdigest()

record = {
    "figure": "Experimental Response Over Time",
    "dataset": str(source_file),
    "dataset_sha256": source_hash,
    "data_type": "synthetic",
    "python_packages": {
        "pandas": pandas.__version__,
        "plotly": plotly.__version__
    },
    "outputs": [
        "accessible_scientific_figure.html"
    ],
    "accessibility_review": "pending",
    "scientific_review": "demonstration_only"
}

Path(
    "figure_provenance.json"
).write_text(
    json.dumps(record, indent=2),
    encoding="utf-8"
)

This produces a basic provenance record. It does not
constitute a complete reproducible research package.
A production workflow should additionally retain code
revision, environment lockfile, figure specification,
output hashes, review evidence, and any relevant
transformation metadata.

12. Common Mistakes

Common accessibility and scientific visualization errors
Mistake Why It Matters Recommended Correction
Using color as the only series distinction Some readers cannot reliably differentiate the groups. Add markers, patterns, or direct labels.
Providing only a chart image Exact observations may be unavailable to assistive-technology users. Include descriptive text and an accessible data table.
Omitting measurement units The numerical magnitude becomes scientifically ambiguous. Label axes and identify unit definitions.
Connecting points without explanation Lines can suggest continuous measurements or interpolation. Explain the observation schedule and meaning of connecting lines.
Adding arbitrary error bars Uncertainty may be misrepresented. Use documented uncertainty estimates derived from valid methods.
Trusting the visual output without numerical checks Rendering or transformation errors may remain hidden. Compare trace values against the source dataset.
Assuming interactive charts are automatically accessible Keyboard and screen-reader functionality may be incomplete. Test actual interaction and provide accessible alternatives.

13. Applying the Workflow in Sustainable Catalyst

The example demonstrates a workflow that can inform future
or existing Sustainable Catalyst research capabilities.
The precise integration status of each application requires
source and deployment verification.

Intended cross-application research workflow
Application Intended Role
Library Register source datasets, metadata, licenses, and references.
Research Lab Explore datasets, experiment with figures, and inspect scientific comparisons.
Workbench Execute reproducible calculations, notebooks, and validated figure-generation workflows.
Site Intelligence Support geospatial datasets and map-based scientific graphics.
Workspace Associate figures with projects, ownership, and scientific review.
Research Connect approved figures to research outputs and supporting evidence.
Reporting & Publication Studio Prepare accessible scientific figures for publication and document export.

In a fully integrated workflow, a verified dataset and its
figure specification should remain linked as research objects.
Approved outputs could then be reused across notebooks,
analytical reports, research publications, and policy briefs
without losing provenance.

This describes an intended capability, not confirmation of
currently functioning cross-application integration.

14. Completion Checklist

Before treating the example as complete, verify the
following:

  • The dataset loads with expected values and types.
  • All observations are finite and have documented units.
  • The rendered traces match the source values.
  • Control and treatment groups remain distinguishable without color alone.
  • Axes and legends identify the scientific variables.
  • Alternative text summarizes the essential comparison.
  • A structured table provides exact numerical observations.
  • Exported figures preserve labels and scientific relationships.
  • Keyboard and assistive-technology limitations have been evaluated.
  • Source data and computational dependencies are documented.
  • The example is clearly identified as synthetic.
  • No unsupported scientific claims are introduced.

15. Expected Deliverables

A completed local exercise should produce the following
artifacts:

  • accessible_scientific_figure_data.csv — source observations.
  • accessible_scientific_figure.html — interactive figure.
  • accessible_scientific_figure.svg — optional static vector figure.
  • figure_provenance.json — basic source and dependency metadata.
  • Python source code or a reproducible notebook containing the generation and validation steps.
  • An accessible descriptive narrative and data table for publication.

Final outcome: The exercise demonstrates a
scientifically traceable, numerically checked visualization
with color-independent encodings and accessible supporting
information. Complete accessibility and production readiness
require additional testing of the actual published interface.

16. Further Reading

  1. W3C Web Accessibility Initiative.
    Web Content Accessibility Guidelines (WCAG) 2.2.

    https://www.w3.org/TR/WCAG22/
  2. W3C WAI.
    Images Tutorial.

    https://www.w3.org/WAI/tutorials/images/
  3. W3C WAI.
    Understanding Use of Color.

    https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html
  4. Plotly.
    Python Graphing Library.

    https://plotly.com/python/
  5. Plotly.
    Static Image Export.

    https://plotly.com/python/static-image-export/
  6. pandas.
    Documentation.

    https://pandas.pydata.org/docs/

Knowledge Base Product: Sustainable Catalyst Research Lab
Category: Worked Examples
Cross-Application Area: Visualization & Graphing
Example Type: Reproducible Scientific Visualization
Dataset Classification: Synthetic
Platform Verification: Pending
Independent Scientific Review: Not completed

Scroll to Top