Worked Examples
Create scientific cartography — Visualization & Graphing
Create scientific cartography — Visualization & Graphing Cross-application area: Visualization & Graphing Status: Initial scientific graphics guidance; platform-specific features not verified. Goal Define map projection, legend, s
Application area: Visualization & Graphing
Article type: Technical how-to / Scientific cartography
Audience: Researchers, geospatial analysts, environmental scientists, remote-sensing specialists, and scientific programmers
Methods: Spatial data preparation, coordinate verification, raster rendering, cartographic classification, and numerical validation
Reference technologies: Python 3, NumPy, Matplotlib, CSV, PNG, and SVG
Primary outputs: Scientific raster map, numerical cell register, accessible data table, and reproducibility manifest
1. Purpose and scientific objective
Scientific cartography communicates geographic observations, spatial relationships, model outputs, and environmental conditions through maps.
Unlike general-purpose illustration, scientific mapping must preserve the location, measurement units, spatial resolution, uncertainty, and meaning of the underlying data.
A map may be visually attractive while geographically or numerically incorrect. Projection distortion, raster misalignment, unsupported interpolation, inappropriate classification, or missing-data handling can materially change its scientific interpretation.
Creating scientifically defensible cartography therefore requires five separate activities:
- Define the research question: Establish what spatial relationship or measurement the map is intended to communicate.
- Validate source information: Confirm coordinates, values, units, provenance, spatial resolution, and permissions.
- Select cartographic methods: Choose an appropriate projection, extent, symbology, classification, and scale.
- Verify the output: Compare the map with the source data and independently calculated geographic properties.
- Preserve the evidence: Archive the processing method, visualization configuration, outputs, and validation record.
Core principle: Map interpretation must remain consistent with the source dataset’s geographic units, spatial resolution, and uncertainty. The renderer must not silently alter authoritative scientific observations.
2. Select the appropriate map type
The map type should follow the scientific question and data structure.
| Map type | Typical use | Important limitation |
|---|---|---|
| Point map | Monitoring sites, samples, sensors, or events | Symbol overlap and sampling bias |
| Choropleth map | Values associated with geographic regions | Classification, denominators, and unequal area |
| Raster heat map | Gridded environmental or modeled quantities | Resolution, interpolation, masking, and normalization |
| Isoline map | Contours of continuous numerical fields | Interpolation and source sampling density |
| Satellite-derived map | Land cover, vegetation, surface properties | Sensor quality, calibration, and acquisition conditions |
| Temporal map | Geographic change across observation dates | Spatial alignment and temporal sampling |
| 3D terrain map | Elevation and surface geometry | Vertical datum, exaggeration, and occlusion |
Do not use a smooth heat map to imply that measurements exist continuously across an area when the underlying data contain only a small number of observations.
3. Establish the cartographic data contract
Before rendering, create a specification that identifies the source, geographic reference, measurement semantics, and intended output.
| Field | Required description |
|---|---|
| Map ID | Stable identifier and revision |
| Research objective | Question or geographic comparison |
| Source dataset | Identity, version, source, and license |
| Coordinate reference | CRS or defined local coordinate system |
| Spatial extent | Geographic or projected bounds |
| Resolution | Pixel size or supported geometric precision |
| Variable | Measured, derived, or modeled quantity |
| Units | Physical or analytical units |
| Missingness | No-data values, masks, and exclusions |
| Processing | Reprojection, aggregation, interpolation, or resampling |
| Uncertainty | Positional, measurement, or model uncertainty |
| Cartographic style | Color scale, class breaks, symbols, and legend |
| Output | Formats, dimensions, accessibility, and provenance |
Preserve authoritative source data separately from derived processing artifacts.
4. Understand coordinate reference systems
A coordinate reference system defines how coordinates relate to geographic positions.
Geographic coordinate systems commonly represent locations using angular coordinates such as latitude and longitude. Projected coordinate systems represent locations on a plane, commonly using linear units.
4.1 CRS assignment versus transformation
Assigning a CRS declares the coordinate system already used by the data. It does not change coordinate values.
Transforming coordinates calculates their positions in another CRS.
Incorrectly assigning a CRS is not a substitute for reprojection and may move a dataset to a scientifically incorrect location.
4.2 Map projection
No flat global map projection preserves area, distance, shape, and direction perfectly everywhere.
Select the projection according to the purpose of the map.
For example, area comparisons may benefit from a suitable equal-area projection, while local metric analysis may require an appropriate projected CRS for the study area.
Web Mercator can be useful for interactive web maps but should not be assumed suitable for uncorrected physical area calculations.
4.3 Axis order
Confirm whether a system expects longitude-latitude, latitude-longitude, easting-northing, or another coordinate order.
Never infer coordinate ordering solely from the number of values in a record.
For actual geospatial datasets, document both the source coordinate convention and the transformation library’s interface behavior.
5. Define spatial resolution and missingness
Spatial resolution determines the level of geographic detail supported by the source.
A raster with 100-meter cells does not contain independently measured values for every one-meter position within those cells.
Displaying the raster at high image resolution does not increase its underlying measurement resolution.
5.1 Source resolution versus export resolution
Distinguish:
- Source resolution: Spatial footprint and spacing of original observations or model cells.
- Processing resolution: Spatial resolution of derived or resampled data.
- Display resolution: Screen pixels or exported image dimensions.
These quantities are not interchangeable.
5.2 Missing-value treatment
Missing cells may result from unavailable observations, quality rejection, geographic exclusion, sensor limitations, or processing masks.
Missing data must not automatically be converted to numerical zero.
If interpolation is used to estimate missing values, identify the estimates as derived and preserve the original mask.
6. Worked example: synthetic scientific raster
The example uses a three-by-three raster in a local synthetic metric coordinate plane.
Each cell has a width and height of 100 meters. The numerical values are synthetic and have arbitrary measurement units.
Scientific classification: This is a computational test fixture, not an Earth-referenced geographic dataset or an observed environmental surface.
6.1 Source observations
| Row | Western cell | Central cell | Eastern cell |
|---|---|---|---|
| North | 7 | 8 | 9 |
| Middle | 4 | No data | 6 |
| South | 1 | 2 | 3 |
6.2 Spatial specification
Coordinate system:
Local synthetic metric plane
West boundary: 500000 m
East boundary: 500300 m
South boundary: 5800000 m
North boundary: 5800300 m
Cell width: 100 m
Cell height: 100 m
Rows: 3
Columns: 3
Total cells: 9
Valid cells: 8
Missing cells: 1
The local coordinate labels do not establish a real-world geographic location. An Earth-based CRS would need to be supplied and independently validated before using this dataset in geographic overlays.
6.3 Expected numerical properties
Valid values:
1, 2, 3, 4, 6, 7, 8, 9
Minimum = 1
Maximum = 9
Sum = 40
Count = 8
Mean = 5
Missing central cell:
Not included in the numerical mean
The nine-cell fixture allows the rendered map to be checked against independently known values and positions.
7. Prepare the Python environment
This example uses Python 3, NumPy, and Matplotlib.
mkdir scientific-cartography
cd scientific-cartography
python3 -m venv .venv
source .venv/bin/activate
python -m pip install numpy matplotlib
python --version
python -m pip freeze
On Windows, use the activation command appropriate to the selected shell.
For a controlled scientific release, pin and archive the actual dependency versions used.
8. Generate the scientific map
Save the following as create_scientific_map.py.
The script constructs the synthetic raster, checks expected numerical values, calculates cell-center coordinates, preserves missingness, renders a map with a fixed color scale, and exports numerical and reproducibility records.
import csv
import hashlib
import json
import sys
from pathlib import Path
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
OUTPUT = Path("output")
OUTPUT.mkdir(exist_ok=True)
# Source fixture:
# First row represents the southernmost cells.
grid = np.array([
[1.0, 2.0, 3.0],
[4.0, np.nan, 6.0],
[7.0, 8.0, 9.0]
])
# Local synthetic metric coordinates.
west = 500000.0
south = 5800000.0
cell_size = 100.0
rows, cols = grid.shape
east = west + cols * cell_size
north = south + rows * cell_size
extent = (west, east, south, north)
# Numerical validation.
assert grid.shape == (3, 3)
assert cell_size > 0
missing = np.isnan(grid)
assert int(missing.sum()) == 1
assert missing[1, 1]
assert not np.isinf(grid).any()
valid = grid[~missing]
assert valid.size == 8
assert float(valid.min()) == 1.0
assert float(valid.max()) == 9.0
assert float(valid.sum()) == 40.0
assert float(valid.mean()) == 5.0
# Spatial geometry validation.
assert east - west == 300.0
assert north - south == 300.0
x_centers = west + (
np.arange(cols) + 0.5
) * cell_size
y_centers = south + (
np.arange(rows) + 0.5
) * cell_size
assert list(x_centers) == [
500050.0,
500150.0,
500250.0
]
assert list(y_centers) == [
5800050.0,
5800150.0,
5800250.0
]
# Export an authoritative cell register.
register = OUTPUT / "cell-register.csv"
with register.open(
"w",
newline="",
encoding="utf-8"
) as handle:
writer = csv.writer(handle)
writer.writerow([
"row_south_to_north",
"column_west_to_east",
"x_center_m",
"y_center_m",
"value",
"classification"
])
for row in range(rows):
for col in range(cols):
value = grid[row, col]
writer.writerow([
row,
col,
x_centers[col],
y_centers[row],
"" if np.isnan(value)
else float(value),
"no_data"
if np.isnan(value)
else "observed_fixture"
])
# Mask the missing observation.
masked = np.ma.masked_invalid(grid)
# Fixed quantitative color limits.
cmap = plt.get_cmap("viridis").copy()
cmap.set_bad("#D9D9D9")
norm = Normalize(
vmin=0,
vmax=10
)
fig, ax = plt.subplots(
figsize=(8, 6)
)
image = ax.imshow(
masked,
origin="lower",
extent=extent,
interpolation="nearest",
cmap=cmap,
norm=norm
)
# Equal coordinate scaling is valid here
# because both dimensions use meters.
ax.set_aspect("equal")
ax.set_xlim(west, east)
ax.set_ylim(south, north)
ax.set_title(
"Synthetic scientific raster map"
)
ax.set_xlabel(
"Local X coordinate (m)"
)
ax.set_ylabel(
"Local Y coordinate (m)"
)
# Draw cell boundaries.
for index in range(cols + 1):
x_line = west + index * cell_size
ax.axvline(
x_line,
color="#555555",
linewidth=0.6
)
for index in range(rows + 1):
y_line = south + index * cell_size
ax.axhline(
y_line,
color="#555555",
linewidth=0.6
)
# Annotate every cell.
for row in range(rows):
for col in range(cols):
value = grid[row, col]
label = (
"No data"
if np.isnan(value)
else str(int(value))
)
ax.text(
x_centers[col],
y_centers[row],
label,
ha="center",
va="center",
fontsize=10,
color="black",
bbox={
"facecolor": "white",
"alpha": 0.85,
"edgecolor": "none",
"pad": 1.5
}
)
fig.colorbar(
image,
ax=ax,
label="Synthetic measurement (arbitrary units)"
)
fig.tight_layout()
png = OUTPUT / "scientific-map.png"
svg = OUTPUT / "scientific-map.svg"
fig.savefig(png, dpi=200)
fig.savefig(svg)
plt.close(fig)
# Create machine-readable metadata.
def sha256(path):
return hashlib.sha256(
path.read_bytes()
).hexdigest()
manifest = {
"fixture": "synthetic-raster-3x3",
"coordinate_reference":
"local synthetic metric plane",
"cell_size_m": cell_size,
"extent": list(extent),
"raster_origin": "lower",
"missing_value_policy":
"preserve as no_data",
"interpolation": "nearest display",
"color_limits": [0, 10],
"valid_cells": int(valid.size),
"missing_cells": int(missing.sum()),
"valid_mean": float(valid.mean()),
"python_version": sys.version.split()[0],
"numpy_version": np.__version__,
"matplotlib_version":
matplotlib.__version__,
"numerical_validation": "pass",
"spatial_fixture_validation": "pass",
"visual_review": "not_tested",
"accessibility_review": "not_tested",
"real_world_crs_validation":
"not_applicable",
"scientific_source_validation":
"not_tested",
"artifacts": {
path.name: sha256(path)
for path in [register, png, svg]
}
}
(OUTPUT / "manifest.json").write_text(
json.dumps(manifest, indent=2),
encoding="utf-8"
)
print("Raster shape:", grid.shape)
print("Valid cells:", valid.size)
print("Missing cells:", missing.sum())
print("Valid mean:", valid.mean())
print("Cell size:", cell_size)
print("Map creation checks passed")
9. Run and inspect the results
Execute:
python create_scientific_map.py
Expected numerical output:
Raster shape: (3, 3)
Valid cells: 8
Missing cells: 1
Valid mean: 5.0
Cell size: 100.0
Map creation checks passed
The following files should be generated:
output/
cell-register.csv
scientific-map.png
scientific-map.svg
manifest.json
Actual execution and visual inspection must be completed before the figure is recorded as validated.
9.1 Inspect orientation
Open scientific-map.png.
The northern row should contain 7, 8, and 9. The southern row should contain 1, 2, and 3.
The renderer uses origin="lower" because the first array row represents the southernmost cells.
An incorrect origin setting could reverse the north-south interpretation without changing the numerical source.
9.2 Inspect missingness
The central cell must remain marked No data.
It must not be shown as zero or silently replaced with an interpolated value.
9.3 Inspect geographic scale
The source spans 300 meters along both local coordinate axes.
Because both coordinate axes use meters, equal display scaling preserves the intended geometry of the synthetic grid.
The resulting map should show square cells, although the exported image itself may have non-square dimensions because it also contains titles, labels, and a color bar.
9.4 Inspect color classification
The map uses the continuous Viridis color map with fixed numerical limits from 0 to 10.
All valid values must map to that same normalization.
The separate No data classification must not imply a valid measurement.
10. Add accessible descriptions and numerical alternatives
Maps convey spatial relationships that may not be fully understandable from short alternative text alone.
Provide a short description, an extended explanation, and an accessible numerical table where appropriate.
10.1 Suggested alternative text
Three-by-three synthetic raster map with values increasing from the southwest toward the northeast. Eight cells contain measurements from 1 to 9, and the central cell is missing. Each cell represents a 100-meter square in a local synthetic coordinate plane.
10.2 Extended description
The southern row contains values 1, 2, and 3 from west to east. The middle row contains 4, a missing center cell, and 6. The northern row contains 7, 8, and 9.
The minimum valid value is 1, the maximum is 9, and the mean of the eight valid cells is 5.
The map does not represent a surveyed geographic location, and its synthetic numbers have no environmental interpretation.
10.3 Equivalent numerical table
For publication, retain Table 3 as an accessible HTML table. The exported CSV provides an additional machine-readable representation of values and coordinate locations.
For complex or interactive scientific maps, evaluate relevant WCAG 2.2 requirements, including color independence, contrast, keyboard operation, and text alternatives.
11. Handle real-world CRS-aware data
The synthetic example deliberately avoids an Earth-based CRS. For actual geospatial data, additional processing is required.
11.1 Read geospatial metadata
For raster datasets, verify:
- Source CRS.
- Affine transform.
- Bounding extent.
- Raster resolution and dimensions.
- Band descriptions and units.
- Missing-value mask.
- Scale factors and offsets.
Libraries such as Rasterio and GDAL provide tools for reading and processing georeferenced raster data.
11.2 Reprojection
If reprojection is required, preserve both the original source and the derived target-grid artifact.
Record the source CRS, target CRS, coordinate transformation, resampling algorithm, and output resolution.
Do not simply replace the CRS identifier while leaving the original coordinates unchanged.
11.3 Resampling
Different data types require different approaches:
| Data type | Consideration |
|---|---|
| Categorical land cover | Nearest-neighbor or another suitable categorical method preserves class identities |
| Continuous measurements | Bilinear or other methods may be suitable if their assumptions and effects are justified |
| Counts and totals | May require aggregation that conserves the quantity being measured |
| Masked observations | Preserve no-data classifications and account for their effect on resampling |
Resampling changes the numerical representation of a dataset. It does not create new independent observations.
12. Design defensible legends and classification
Cartographic legends must accurately describe how values are represented.
12.1 Continuous variables
Use a suitable continuous scale for quantities such as temperature, concentration, or modeled intensity.
Document units, limits, and normalization.
12.2 Categorical variables
Use discrete labels and symbols for classes such as land-cover types.
Do not treat category codes as continuous physical measurements.
12.3 Choropleth classification
When mapping geographic regions, define the method used to group quantitative values.
Classifications may use fixed intervals, quantiles, standard deviations, or other documented statistical methods.
For comparisons across dates or locations, changing class boundaries can create misleading visual differences.
12.4 Counts and rates
Raw event counts may be influenced by regional population, exposure, geographic area, or sampling effort.
Where the scientific question concerns rates or relative risk, use an appropriate denominator and document the calculation.
Do not automatically interpret a concentration of events as evidence of greater underlying risk.
13. Satellite and remote-sensing maps
Scientific cartography frequently uses satellite and aerial observations.
Examples include:
- Multispectral satellite composites.
- Vegetation indices.
- Land-cover classification.
- Surface temperature.
- Soil and vegetation monitoring.
- Environmental change detection.
For these applications, preserve sensor identity, acquisition time, processing level, band definitions, spatial resolution, radiometric scale factors, quality masks, and geographic registration.
A visually clear satellite image does not automatically constitute a quantitatively validated scientific map.
Do not treat cloud-filled or temporally interpolated pixels as directly observed values.
14. Temporal and three-dimensional cartography
Scientific maps may represent geographic change through time or incorporate elevation and other three-dimensional geometry.
14.1 Temporal maps
Confirm that each frame uses the correct observation timestamp, coordinate reference, spatial extent, missing-data treatment, and numerical normalization.
Distinguish original observations from composites, interpolations, and model-generated frames.
14.2 Three-dimensional maps
For terrain or spatial models, validate horizontal coordinates, elevation reference, physical units, camera projection, and any vertical exaggeration.
A three-dimensional presentation does not independently validate a terrain model, subsurface reconstruction, or numerical simulation.
15. Scientific acceptance tests
| Test | Pass condition | Evidence |
|---|---|---|
| Source integrity | Authoritative dataset and version preserved | Provenance and checksum |
| Coordinate integrity | CRS or local coordinate system correctly interpreted | Spatial metadata review |
| Spatial resolution | Displayed detail is consistent with source measurements | Resolution and processing record |
| Grid geometry | Raster extent, orientation, and cell spacing are correct | Spatial fixture |
| Numerical fidelity | Mapped values match source or documented transformations | Golden-fixture assertions |
| Missingness | No-data states remain distinct from valid zeros | Mask and visual review |
| Projection | Map projection supports intended geographic interpretation | CRS and projection review |
| Legend | Color limits, units, and categories are accurately labeled | Cartographic review |
| Uncertainty | Material measurement or spatial uncertainty disclosed | Scientific review |
| Accessibility | Essential information available through appropriate alternatives | Accessibility assessment |
| Export safety | Authorized formats and information disclosure rules respected | Export review |
| Reproducibility | Independent execution reconstructs required numerical results | Execution evidence |
| Scientific interpretation | Conclusions do not exceed source resolution or supported evidence | Reviewer decision |
Acceptance rule: Record applicable tests as Pass, Fail, or Not Tested. The reference script performs numerical fixture checks but does not replace visual, accessibility, geographic, or independent scientific review.
16. Troubleshooting common creation problems
| Problem | Likely cause | Corrective action |
|---|---|---|
| Map appears shifted | Incorrect CRS or coordinate transformation | Verify source reference and spatial control points |
| Raster is upside down | Incorrect row orientation | Check source row order and image origin |
| Cells appear stretched | Incorrect aspect or units | Verify spatial extent and coordinate scaling |
| Missing cells appear as zero | Lost no-data mask | Preserve missingness and use explicit classification |
| Map looks excessively smooth | Display interpolation or resampling | Check processing and rendering interpolation |
| Identical values use different colors | Different color normalization | Apply consistent, justified numerical limits |
| Spatial features disappear | Filtering, clipping, masking, or invalid geometry | Compare source records and rendered layer state |
| Export differs from preview | Renderer or output configuration | Reconcile settings and verify exported artifact |
For further diagnosis, consult Troubleshoot scientific cartography — Visualization & Graphing.
17. Reproducibility and evidence preservation
For each scientific map, archive:
- Authoritative source dataset or governed source reference.
- Dataset provenance and permitted-use record.
- Coordinate reference and spatial geometry.
- Measurement units and uncertainty information.
- Missing-data masks and quality flags.
- Reprojection, resampling, and processing rules.
- Rendering script and software versions.
- Map projection, legend, scale, and color configuration.
- Numerical cell or feature register.
- Rendered outputs and accessible descriptions.
- Execution records and integrity hashes.
- Independent review findings and known limitations.
SHA-256 hashes verify artifact identity rather than geographic or scientific validity.
Exact image-file bytes may differ across rendering environments, so numerical validation and visual acceptance must be recorded independently.
18. Sustainable Catalyst application workflow
The following describes the intended cross-application workflow. It is not evidence that the integrations are currently operational.
| Application | Responsibility |
|---|---|
| Library | Preserve spatial datasets, licenses, source versions, geographic metadata, and provenance |
| Research Lab | Validate spatial analysis, measurement semantics, model assumptions, and uncertainty |
| Workbench | Where implemented, execute reproducible geospatial processing and rendering |
| Visualization & Graphing | Render maps with documented projections, scales, classifications, accessible alternatives, and exports |
| Site Intelligence | Where implemented, provide geospatial context, raster processing, and geographic analysis |
| Research | Associate maps with evidence, methods, research findings, and publication outputs |
| Workspace | Manage project relationships, review status, authorization, and publication readiness |
Before identifying an actual Sustainable Catalyst mapping engine as verified, record its owning repository, source-code path, deployed version, supported data schema, rendering interfaces, test receipts, and runtime evidence.
Potential technologies include Matplotlib, MapLibre, Rasterio, GDAL, and PyProj, but their inclusion in a design or support article is not proof of deployment.
19. Scientific limitations
A scientifically formatted map cannot correct unreliable measurements, biased sampling, invalid statistical assumptions, inappropriate geographic boundaries, or unsupported spatial interpolation.
A raster displayed at high resolution does not contain more original spatial information than its source data.
Similarly, a three-dimensional rendering or animated geographic sequence does not demonstrate that the underlying environmental model has been physically validated.
Source-data validity, geographic accuracy, numerical processing, visual presentation, accessibility, and scientific interpretation must be evaluated separately.
20. Technical references
- Matplotlib — Origin and extent in imshow. Raster orientation and coordinate placement.
- Matplotlib — imshow documentation. Raster rendering and display interpolation.
- NumPy — Official Documentation. Numerical arrays and source-value validation.
- Rasterio — Official Documentation. Georeferenced raster processing.
- PyProj — Official Documentation. Coordinate reference systems and transformations.
- GDAL — Official Documentation. Geospatial raster and vector data processing.
- W3C — Web Content Accessibility Guidelines 2.2. Accessibility of published visualizations.
- W3C WAI — Complex Images. Accessible descriptions of scientific maps.
21. Completion and verification record
| Field | Required value |
|---|---|
| Map ID | Stable identifier and revision |
| Source | Dataset version, provenance, and checksum |
| Coordinate reference | CRS or documented local coordinate system |
| Spatial resolution | Source and processed resolution |
| Projection | Selected map projection and purpose |
| Renderer | Software and installed version |
| Numerical validation | Pass, Fail, or Not Tested |
| Geographic validation | Pass, Fail, or Not Tested |
| Visual validation | Pass, Fail, or Not Tested |
| Accessibility | Pass, Fail, or Not Tested |
| Export safety | Pass, Fail, or Not Tested |
| Reproducibility | Pass, Fail, or Not Tested |
| Scientific review | Pass, Fail, or Not Tested |
| Reviewer | Actual reviewer and review date |
| Evidence | Data, test results, maps, logs, and hashes |
| Limitations | Unresolved scientific or technical concerns |
Completion criterion: The scientific map must preserve authoritative observations, correctly represent spatial coordinates and measurement units, use defensible cartographic scales and classifications, provide accessible alternatives, and retain sufficient evidence for independent reproduction.
Current verification status: Cartographic creation methodology documented. Sustainable Catalyst mapping features remain subject to source-specific and deployed-software acceptance testing.
