◆ Styles

Styles

The same computation, drawn in other ways. Every figure on this page was generated by the library when the site was built, and shows below it the exact options that make it: as JSON (the door shared by Rust, JavaScript, Python and R) and on the command line.

The data are real and public: the network of urban influence in Pernambuco (REGIC, regic_pe.json), with k = 1 and framed on the state outline, and the journeys between the municipalities of the Recife metropolitan region (rmr_municipios.json); the sources are in the gallery. The command of each figure names the file it uses. Both forms of every figure were checked byte for byte when the site was built: the JSON options and the command line give the same file. --title "" only removes the title, which the command line adds by default and the JSON door does not.

In sections 1 to 3 only the style changes: the FlowSpec is the same and the SVG is a pure function of it and of the style. Section 4 changes the computation.

1. Themes and palettes

The theme (theme) sets the paper, the halos, the ink of the text, the context and the accent colour. The palette (palette) changes only the colour of the corridors, tuned to the paper; an explicit colour (accent) wins over both. Colour has one role only: the accent of the corridors. Volume is never coded by colour, only by width.

themepapercorridorsfor
"light" (default)warm off-white, light landred #C9372Cscreen
"dark"#16181B, darker landcoral #FF7A5Cscreen, slides
"print"white, very light grey landdark greyblack-and-white print: every colour is a grey
"basemap"none; land not filledred at 0.85laying over a base map
The palettes (chapter 7, “Palettes”): one colour on light paper, another on dark paper.
palettelight paper (light, print, basemap)dark paper (dark)
"red" (the light and dark themes' own)#C9372C#FF7A5C
"blue"#1F5FAD#5AAAF0
"green"#1D7A45#4CC38A
"amber"#A86200#F2B33D
"purple"#7A3F9E#B992F2
"graphite"#3E444B#C3C9CF

Each colour is tested at a contrast of at least 3:1 (WCAG) against the halo, the background and the land of every theme; the lowest is amber on the light land, 4.1. Labels never take the accent.

In print everything is grey; a palette brings colour back to the corridors only, for a colour printer. In basemap there is no background nor filled land, halos are white and corridors sit at 0.85 opacity, to lay over a map: here the figure sits on a checkerboard to show the transparency.

light (default). 100% of the volume in 228 segments · 10 places off the map · 13 labels left out
light (default)
{"k": 1, "style": {"frame_on_boundary": true, "max_labels": 40, "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --frame boundary --labels 40 --lang en
dark. 100% of the volume in 228 segments · 10 places off the map · 13 labels left out
dark
{"k": 1, "style": {"frame_on_boundary": true, "max_labels": 40, "theme": "dark", "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --frame boundary --labels 40 --theme dark --lang en
print. 100% of the volume in 228 segments · 10 places off the map · 13 labels left out
print
{"k": 1, "style": {"frame_on_boundary": true, "max_labels": 40, "theme": "print", "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --frame boundary --labels 40 --theme print --lang en
basemap, palette: "blue". 100% of the volume in 228 segments · 10 places off the map · 13 labels left out
basemap, palette: "blue"
{"k": 1, "style": {"frame_on_boundary": true, "max_labels": 40, "theme": "basemap", "palette": "blue", "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --frame boundary --labels 40 --theme basemap --palette blue --lang en
Every combination of theme and palette (16 figures, on the Recife metropolitan region)

Light theme

Light, the theme's colour. 37% of the volume in 15 segments · 63% internal to the places
Light, the theme's colour
{"style": {"lang": "en"}}
milkflow rmr_municipios.json --title "" --lang en
palette: "blue". 37% of the volume in 15 segments · 63% internal to the places
palette: "blue"
{"style": {"palette": "blue", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette blue --lang en
palette: "green". 37% of the volume in 15 segments · 63% internal to the places
palette: "green"
{"style": {"palette": "green", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette green --lang en
palette: "amber". 37% of the volume in 15 segments · 63% internal to the places
palette: "amber"
{"style": {"palette": "amber", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette amber --lang en
palette: "purple". 37% of the volume in 15 segments · 63% internal to the places
palette: "purple"
{"style": {"palette": "purple", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette purple --lang en
palette: "graphite". 37% of the volume in 15 segments · 63% internal to the places
palette: "graphite"
{"style": {"palette": "graphite", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette graphite --lang en

Dark theme

Dark, the theme's colour. 37% of the volume in 15 segments · 63% internal to the places
Dark, the theme's colour
{"style": {"theme": "dark", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --lang en
palette: "blue". 37% of the volume in 15 segments · 63% internal to the places
palette: "blue"
{"style": {"theme": "dark", "palette": "blue", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette blue --lang en
palette: "green". 37% of the volume in 15 segments · 63% internal to the places
palette: "green"
{"style": {"theme": "dark", "palette": "green", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette green --lang en
palette: "amber". 37% of the volume in 15 segments · 63% internal to the places
palette: "amber"
{"style": {"theme": "dark", "palette": "amber", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette amber --lang en
palette: "purple". 37% of the volume in 15 segments · 63% internal to the places
palette: "purple"
{"style": {"theme": "dark", "palette": "purple", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette purple --lang en
palette: "graphite". 37% of the volume in 15 segments · 63% internal to the places
palette: "graphite"
{"style": {"theme": "dark", "palette": "graphite", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette graphite --lang en

Print and base map

Print. 37% of the volume in 15 segments · 63% internal to the places
Print
{"style": {"theme": "print", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme print --lang en
Print, palette: "blue". 37% of the volume in 15 segments · 63% internal to the places
Print, palette: "blue"
{"style": {"theme": "print", "palette": "blue", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme print --palette blue --lang en
Base map. 37% of the volume in 15 segments · 63% internal to the places
Base map
{"style": {"theme": "basemap", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme basemap --lang en
Base map, palette: "blue". 37% of the volume in 15 segments · 63% internal to the places
Base map, palette: "blue"
{"style": {"theme": "basemap", "palette": "blue", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme basemap --palette blue --lang en

2. Stroke and directions

One solid band per segment (the default), a bundle of thin rails, or one lane per direction. With rails (stroke: "rails") class c becomes c + 1 rails of rail_width px separated by rail_gap px, at most max_rails. With directions: "split" each direction gets its own lane, on the right of the traveller (right-hand traffic), with the class of its own volume on the legend's breaks; the asymmetry between the two directions shows.

direction_colours: true (only with split) paints each lane in one of two colours safe for colour-blind readers (blue and orange, Okabe–Ito): orange when the lane heads to the main place (the one with the largest own volume), blue when it leaves it. In a city with one centre that reads “towards the centre” and “away from it” on every corridor; in the Recife region, towards Recife.

Solid band (default). 37% of the volume in 15 segments · 63% internal to the places
Solid band (default)
{"style": {"lang": "en"}}
milkflow rmr_municipios.json --title "" --lang en
Rails. 37% of the volume in 15 segments · 63% internal to the places
Rails 1.6 px, 1.5 px gap, up to 8 (the defaults).
{"style": {"stroke": "rails", "lang": "en"}}
milkflow rmr_municipios.json --title "" --stroke rails --lang en
One lane per direction, two colours. 37% of the volume in 15 segments · 63% internal to the places
One lane per direction, two colours Orange: towards Recife.
{"style": {"directions": "split", "direction_colours": true, "lang": "en"}}
milkflow rmr_municipios.json --title "" --directions split --direction-colours --lang en

Rails and split directions do not combine: the library draws the lanes solid and the command line refuses the combination. In a dense centre the split lanes are narrowed (down to 45%) and are still wide. In the lines mode (Lines) split, direction_colours and rails are ignored: the lines take the width of the corridor.

3. Corners and places

corners sets how strokes turn and end, for bands, rails and lanes: "round" (default), "mitre" (mitred joins, butt ends, square junctions: a technical look), "smooth" (the bends inside a segment become arcs of radius corner_radius, 12 px by default) or "bevel" (each bend is cut by a straight piece that starts corner_radius before it). The radius is limited by half the shorter piece next to each bend, so two arcs never overlap. In the geographic layout segments are straight and only bend at places, which the symbol covers; that is why the figures of this section are pinned (schematic_options: {pin: true}, --pin): every municipality stays at its point and the segments bend at 0°, 45° and 90°.

place_shape: "square" draws each place as a rounded square of the same area as the circle.

Round (default). 37% of the volume in 15 segments · 63% internal to the places
Round (default)
{"schematic": true, "schematic_options": {"pin": true}, "style": {"lang": "en"}}
milkflow rmr_municipios.json --title "" --pin --lang en
Smooth, radius 16. 37% of the volume in 15 segments · 63% internal to the places
Smooth, radius 16
{"schematic": true, "schematic_options": {"pin": true}, "style": {"corners": "smooth", "corner_radius": 16, "lang": "en"}}
milkflow rmr_municipios.json --title "" --pin --corners smooth --corner-radius 16 --lang en
Bevel, 12 px. 37% of the volume in 15 segments · 63% internal to the places
Bevel, 12 px
{"schematic": true, "schematic_options": {"pin": true}, "style": {"corners": "bevel", "corner_radius": 12, "lang": "en"}}
milkflow rmr_municipios.json --title "" --pin --corners bevel --corner-radius 12 --lang en
Mitre, square places. 37% of the volume in 15 segments · 63% internal to the places
Mitre, square places
{"schematic": true, "schematic_options": {"pin": true}, "style": {"corners": "mitre", "place_shape": "square", "lang": "en"}}
milkflow rmr_municipios.json --title "" --pin --corners mitre --place-shape square --lang en

Fading by volume (fade, --fade) lightens each segment towards the paper by its volume, so that the trunks stand out; with bevelled corners on REGIC, in the gallery.

4. The parameters of the computation: mu, k, max_stretch

These are not style: they change the skeleton and so the FlowSpec. mu weighs the detour against the ink (larger, more segments and less detour); k is how many pairs per place design the skeleton (0: all of them); max_stretch bounds the detour of each design pair during pruning. Every pair is still routed (represent: "all"): the volume in corridors is the same, what changes is which way it goes. The effect of mu and k, step by step, is in How it works. On REGIC, k changes the drawing a lot:

k = 1. 100% of the volume in 228 segments · 10 places off the map · 13 labels left out
k = 1228 segments · mean detour 1.25, max. 28.05 · 100% of the volume in corridors
{"k": 1, "style": {"frame_on_boundary": true, "max_labels": 40, "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --frame boundary --labels 40 --lang en
k = 3 (default). 100% of the volume in 244 segments · 10 places off the map · 13 labels left out
k = 3 (default)244 segments · mean detour 1.11, max. 8.17 · 100% of the volume in corridors
{"style": {"frame_on_boundary": true, "max_labels": 40, "lang": "en"}}
milkflow regic_pe.json --title "" --frame boundary --labels 40 --lang en

With k = 1 each place designs the skeleton with its largest link alone, and the regional trunks show; with k = 3 the skeleton has more segments and the pairs detour less. The detour is the path length in the skeleton over the straight distance; the mean is weighted by the value of the pairs. max_stretch only binds the design pairs: the other pairs, routed afterwards, may detour more. The number of segments is not necessarily monotone in mu.

5. Language

lang ("pt", the default, "en", "es" or "fr") chooses the language of the fixed texts: legend, honesty line, tooltips and the interactive page. Numbers follow the language: 12.345 and 4,5 mil in Portuguese and Spanish, 12,345 and 4.5k in English, 12 345 and 4,5 k in French. The figures of each version of this site were drawn with the lang of its language. The summary that the command line prints stays in Portuguese.

The corridor figure with the legend in Portuguese.
lang: "pt" (default).
The same figure with the legend in English.
lang: "en".

6. Framing on the boundary: frame_on_boundary

When some places lie far from the region (a destination in another state), the frame that holds everything shrinks the region. frame_on_boundary: true (--frame boundary) frames the boundary alone, so the region fills the canvas. What is left out is not cut in silence: a place outside the view is not drawn and enters the honesty line (“10 places off the map”), and the segment towards it is cut at the edge and ends in an arrow in the stroke colour, its tip on the edge, pointing out along the segment; the arrow's tooltip is the segment's. Nothing is drawn outside the canvas. The data is REGIC in Pernambuco with k = 1, the same as in the gallery.

frame_on_boundary: false (default): everything in the frame. 100% of the volume in 228 segments · 32 labels left out
frame_on_boundary: false (default): everything in the frame228 segments · mean detour 1.25, max. 28.05 · 100% of the volume in corridors
{"k": 1, "style": {"max_labels": 40, "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --labels 40 --lang en
frame_on_boundary: true: the state fills the canvas. 100% of the volume in 228 segments · 10 places off the map · 13 labels left out
frame_on_boundary: true: the state fills the canvas228 segments · mean detour 1.25, max. 28.05 · 100% of the volume in corridors
{"k": 1, "style": {"frame_on_boundary": true, "max_labels": 40, "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --frame boundary --labels 40 --lang en
Enlarged detail of the framed figure: the segments that leave through the bottom edge fade out past the boundary (Juazeiro/BA → Salvador/BA; Juazeiro/BA → Brasília/DF).
Detail of the figure on the right (the same SVG, cropped and enlarged 1.6 times): the segments leaving the state go on a little past the boundary and fade into the paper (exits: "fade", the default), here Juazeiro/BA → Salvador/BA and Juazeiro/BA → Brasília/DF.

Each line leaves in its own colour and fades: “leaves this way”, without suggesting a direction (the segment sums both). exits: "dashed" continues it dashed and "arrow" draws the former arrowhead. Where it goes is in the spec and in the segment's tooltip (and in the interactive page). Labels do not avoid the boundary.

7. TikZ

Every style on this page also applies to the TikZ figure (--tikz, tikz: true), written from the same scene as the SVG; the reference shows the SVG and the compiled PDF side by side with lines, rails, the dark theme and two directions.

8. Other style options

Not pictured here, all in the reference: the starting canvas (width, height, margin), the class widths (class_widths), the title (title), how many labels and leader lines (max_labels, key_labels), explicit colours (accent, background), the type size (font_size), the radii of the places (radius_min, radius_max) and the opacities (corridor_opacity, context_opacity). The options of the lines by category (lines, line_width, line_colours) are in Lines.

To try the combinations in the browser: Playground.