All examples
Visualization

Tell a scientific story with Aner Plot

Compose synthetic scientific charts, compare light, dark and company themes, and join values to offline USA and world boundaries.

plot_story.aner
import aner.plot

let weeks = List(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)
let response = List(12.0, 15.0, 14.0, 19.0, 21.0, 23.0)
let reference = List(10.0, 12.0, 13.0, 14.0, 16.0, 17.0)
let company = plot.theme("light").company(
    name: "Example Research",
    background: "#FFFFFF",
    foreground: "#17233B",
    colors: List("#007C91", "#C6601D", "#6950A1")
)
let trend = plot.line(x: weeks, y: response)
    .add_line(x: weeks, y: reference, name: "Reference")
    .title("Response increased across six synthetic observations")
    .labels(x: "Week", y: "Response (arbitrary units)")
    .caption("Synthetic sequences; reference values are supplied, not fitted.")
    .annotate(x: 6.0, y: 23.0, text: "Last observation")
    .theme(company)
    .size(width: 900, height: 560)
trend.show()

plot.scatter(x: weeks, y: response)
    .title("Each point is one supplied observation")
    .labels("Week", "Response (arbitrary units)")
    .theme(plot.theme("dark"))
    .show()

plot.bar(labels: List("Control", "Treatment"), values: List(12.0, 18.0))
    .title("Supplied counts by synthetic group")
    .labels("Group", "Count")
    .caption("Two supplied counts; no automatic aggregation or confidence interval.")
    .theme(company)
    .show()

plot.histogram(values: response, bins: 4)
    .title("Distribution of six synthetic responses")
    .labels("Response (arbitrary units)", "Observed count")
    .caption("Four equal-width bins; counts are not probability density.")
    .theme(plot.theme("light"))
    .show()

plot.box(values: response)
    .title("Observed sample spread")
    .labels("Synthetic sample", "Response (arbitrary units)")
    .caption("Quartiles and whiskers summarize observations, not confidence intervals.")
    .show()

plot.heatmap(values: List(1.0, 2.0, 3.0, 4.0, 5.0, 6.0), rows: 2, columns: 3)
    .title("Six supplied row-major measurements")
    .labels("Column", "Row")
    .caption("Synthetic cells; color represents the supplied value.")
    .show()

let geometry = "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"code\":\"A\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[0,0],[2,0],[2,2],[0,2],[0,0]]]}},{\"type\":\"Feature\",\"properties\":{\"code\":\"B\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[2,0],[4,0],[4,2],[2,2],[2,0]]]}}]}"
plot.choropleth(geojson: geometry, property: "code", keys: List("A", "B"), values: List(12.0, 18.0))
    .title("Two invented regions, joined by String code")
    .caption("Synthetic geometry and values; not real USA or world boundaries.")
    .show()

plot.world(keys: List("USA", "CAN", "FRA"), values: List(12.0, 9.0, 15.0))
    .title("Synthetic values on an offline world map")
    .caption("Synthetic values; boundaries: Natural Earth 1:110m, admin-0 codes.")
    .show()

plot.usa(keys: List("CA", "CO", "NY", "TX"), values: List(18.0, 12.0, 15.0, 9.0))
    .title("Synthetic values for four USA states")
    .caption("Synthetic values; other states have no data, not zero. Natural Earth boundaries.")
    .theme(company)
    .show()

Run step by step in VS Code.

The notebook separates loading, splitting, model configuration, training, and evaluation into cells. It opens with empty outputs, shared variables, and Development inspection enabled.

  1. Install a compatible native Aner executable and VS Code extension using the editor guide. These datasets and fitted classifier pipelines require the current native development engine.
  2. Download the .anernb notebook and open it in your VS Code project. If it appears as JSON, choose Reopen Editor With… → Aner Notebook.
  3. Select the Aner — notebook kernel and keep Shared variables active. Run code cells from top to bottom, or choose Run All. Later cells reuse the datasets, network, and fitted model from earlier cells.
  4. Read the results below each cell. Open Inspector to inspect native variables. Use Aner: Open Development Training Report to inspect the recorded loss, topology, and available gradients after the fitting cell completes.

After changing an earlier cell, rerun its dependent cells. Use Aner: Restart Notebook Session, then Run All, for a clean experiment. Saved outputs are historical; reopening the file starts without live variables. The notebook guide explains session state, inspection, and runtime controls.

Make it your experiment.

With a compatible development runtime installed, save this program as examples/plot_story.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/plot_story.aner
aner run examples/plot_story.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires a chart enabled native Aner 0.0.2-dev.1 development build and development VS Code extension 0.1.46 for notebook display. The published 0.0.2 runtime and 0.1.45 extension predate this module. Development packages are not available on this website. Use the compatible installed aner command to check and run the source, or open the notebook in VS Code, restart its session and choose Run All. No external data, network connection or credentials are required.

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner