<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/battles-and-space-filling-curves-r0eaml9fq" -->

---
title: Battles and space-filling curves | daily.dev
description: A space-filling curve can turn 2D map locations into a 1D axis, making it possible to plot location against time on a single 2D chart. The post illustrates...
canonical: https://daily.dev/posts/battles-and-space-filling-curves-r0eaml9fq
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Battles and space-filling curves | daily.dev
og:description: A space-filling curve can turn 2D map locations into a 1D axis, making it possible to plot location against time on a single 2D chart. The post illustrates...
og:url: https://daily.dev/posts/battles-and-space-filling-curves-r0eaml9fq
og:image: https://api.daily.dev/og/posts/r0eAMl9Fq.png
og:image:alt: Battles and space-filling curves
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Battles and space-filling curves

**[R-bloggers](https://daily.dev/sources/rbloggers)** · 4 min read · 0 upvotes · 0 comments

## Summary

A space-filling curve can turn 2D map locations into a 1D axis, making it possible to plot location against time on a single 2D chart. The post illustrates this with about 550 historical UK battles pulled from Wikidata via SPARQL, using a Hilbert curve over a 64x64 grid. Points close together on the curve stay close on the map, though the reverse isn't guaranteed. The resulting plot reveals clusters for Wales, Scotland and England, plus visible patterns like the English Civil War, the Jacobite Rebellion, the Conquest of Wales, and twentieth-century battles near London.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.r-bloggers.com/2026/10/battles-and-space-filling-curves>

## Questions this post answers

### What is a space-filling curve used for in data visualization?

A space-filling curve reduces a 2D location to a single 1D axis so it can be plotted alongside another variable like time. It snakes across a grid, such as a 64x64 grid, visiting every cell once. Points near each other on the 1D curve are guaranteed to be close in 2D, though the reverse isn't guaranteed; 2D-close points can end up far apart on the curve.

_Exploring dimensionality reduction techniques like this is easier with developer content curated on daily.dev._

### How is a Hilbert curve matrix constructed for visualization?

A function takes an integer n as input and produces a 2^n by 2^n matrix representing the curve's visiting order, starting at zero and following the numbers in sequence. As n increases, the curve becomes more complex; one example used a 64x64 grid (n corresponding to that size) to map UK battle locations.

_Developers building custom visualizations can find more R and graphics walkthroughs on daily.dev._

## Similar posts on daily.dev

- [Home page for spacefilling curves and applications](https://daily.dev/posts/home-page-for-spacefilling-curves-and-applications-9mbis7vxp) · Hacker News · 0 upvotes · 0 comments
- [Having fun while exploring topology](https://daily.dev/posts/having-fun-while-exploring-topology-wm95zu41b) · Vincent D. Warmerdam · 50 upvotes · 3 comments
- [The mathematical beauty of hyperbezier curves](https://daily.dev/posts/the-mathematical-beauty-of-hyperbezier-curves-zyzursfmh) · Lobsters · 1 upvotes · 0 comments

---

Tags: [#machine-learning](https://daily.dev/tags/machine-learning), [#r](https://daily.dev/tags/r), [#data-visualization](https://daily.dev/tags/data-visualization)

[View this post on daily.dev](https://daily.dev/posts/battles-and-space-filling-curves-r0eaml9fq)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Battles and space-filling curves","url":"https://daily.dev/posts/battles-and-space-filling-curves-r0eaml9fq","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/battles-and-space-filling-curves-r0eaml9fq"},"datePublished":"2026-10-26T11:20:50.696Z","dateModified":"2026-10-26T11:32:27.597Z","description":"A space-filling curve can turn 2D map locations into a 1D axis, making it possible to plot location against time on a single 2D chart. The post illustrates...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f56bd36c9c8c7f57c867cbb47c049908?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f56bd36c9c8c7f57c867cbb47c049908?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"R-bloggers","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"R-bloggers","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/98bcbbdf72774292a55ceda8f2277f1e","url":"https://daily.dev/sources/rbloggers"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/battles-and-space-filling-curves-r0eaml9fq","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"machine-learning,r,data-visualization","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"R-bloggers","item":"https://daily.dev/sources/rbloggers"},{"@type":"ListItem","position":3,"name":"Battles and space-filling curves"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/battles-and-space-filling-curves-r0eaml9fq#faq","mainEntity":[{"@type":"Question","name":"What is a space-filling curve used for in data visualization?","acceptedAnswer":{"@type":"Answer","text":"A space-filling curve reduces a 2D location to a single 1D axis so it can be plotted alongside another variable like time. It snakes across a grid, such as a 64x64 grid, visiting every cell once. Points near each other on the 1D curve are guaranteed to be close in 2D, though the reverse isn't guaranteed; 2D-close points can end up far apart on the curve. Exploring dimensionality reduction techniques like this is easier with developer content curated on daily.dev."}},{"@type":"Question","name":"How is a Hilbert curve matrix constructed for visualization?","acceptedAnswer":{"@type":"Answer","text":"A function takes an integer n as input and produces a 2^n by 2^n matrix representing the curve's visiting order, starting at zero and following the numbers in sequence. As n increases, the curve becomes more complex; one example used a 64x64 grid (n corresponding to that size) to map UK battle locations. Developers building custom visualizations can find more R and graphics walkthroughs on daily.dev."}}]}
```

