◆ 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.
theme | paper | corridors | for |
|---|---|---|---|
"light" (default) | warm off-white, light land | red #C9372C | screen |
"dark" | #16181B, darker land | coral #FF7A5C | screen, slides |
"print" | white, very light grey land | dark grey | black-and-white print: every colour is a grey |
"basemap" | none; land not filled | red at 0.85 | laying over a base map |
palette | light 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){"k": 1, "style": {"frame_on_boundary": true, "max_labels": 40, "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --frame boundary --labels 40 --lang endark{"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 enprint{"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 enbasemap, 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 enEvery combination of theme and palette (16 figures, on the Recife metropolitan region)
Light theme
{"style": {"lang": "en"}}
milkflow rmr_municipios.json --title "" --lang enpalette: "blue"{"style": {"palette": "blue", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette blue --lang enpalette: "green"{"style": {"palette": "green", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette green --lang enpalette: "amber"{"style": {"palette": "amber", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette amber --lang enpalette: "purple"{"style": {"palette": "purple", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette purple --lang enpalette: "graphite"{"style": {"palette": "graphite", "lang": "en"}}
milkflow rmr_municipios.json --title "" --palette graphite --lang enDark theme
{"style": {"theme": "dark", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --lang enpalette: "blue"{"style": {"theme": "dark", "palette": "blue", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette blue --lang enpalette: "green"{"style": {"theme": "dark", "palette": "green", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette green --lang enpalette: "amber"{"style": {"theme": "dark", "palette": "amber", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette amber --lang enpalette: "purple"{"style": {"theme": "dark", "palette": "purple", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette purple --lang enpalette: "graphite"{"style": {"theme": "dark", "palette": "graphite", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme dark --palette graphite --lang enPrint and base map
{"style": {"theme": "print", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme print --lang enpalette: "blue"{"style": {"theme": "print", "palette": "blue", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme print --palette blue --lang en{"style": {"theme": "basemap", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme basemap --lang enpalette: "blue"{"style": {"theme": "basemap", "palette": "blue", "lang": "en"}}
milkflow rmr_municipios.json --title "" --theme basemap --palette blue --lang en2. 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.
{"style": {"lang": "en"}}
milkflow rmr_municipios.json --title "" --lang en{"style": {"stroke": "rails", "lang": "en"}}
milkflow rmr_municipios.json --title "" --stroke rails --lang en{"style": {"directions": "split", "direction_colours": true, "lang": "en"}}
milkflow rmr_municipios.json --title "" --directions split --direction-colours --lang enRails 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.
{"schematic": true, "schematic_options": {"pin": true}, "style": {"lang": "en"}}
milkflow rmr_municipios.json --title "" --pin --lang en{"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{"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{"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 enFading 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, "style": {"frame_on_boundary": true, "max_labels": 40, "lang": "en"}}
milkflow regic_pe.json --title "" --k 1 --frame boundary --labels 40 --lang en{"style": {"frame_on_boundary": true, "max_labels": 40, "lang": "en"}}
milkflow regic_pe.json --title "" --frame boundary --labels 40 --lang enWith 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.
lang: "pt" (default).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 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 enframe_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 enexits: "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.