A flow map that draws one line per origin-destination pair becomes
unreadable quickly: n places can have up to n ² pairs.
milkflow simplifies before drawing : it routes the flows
through a few shared corridors, draws each corridor with a width class,
and tells you how much of the volume ended up where.
library ( milkflow )
head ( demo_nodes )
#> id label x y population district
#> 1 T01 Marar 32914 59404 240000 North
#> 2 T02 Belpal 31397 46365 55900 North
#> 3 T03 Quinmar 36060 59349 5500 North
#> 4 T04 Falir 29714 53508 4600 North
#> 5 T05 Arjun 35183 62609 26600 North
#> 6 T06 Halbel 43768 58863 9300 North
head ( demo_flows )
#> origin destination value category
#> 1 T01 T01 597 work
#> 2 T01 T01 477 study
#> 3 T01 T01 126 leisure
#> 4 T01 T02 1081 work
#> 5 T01 T02 83 study
#> 6 T01 T02 97 leisure
The example data are synthetic: 24 invented towns in three districts,
on a plane measured in metres, with gravity-model commuting flows split
by trip purpose (category: work, study or leisure).
A corridor map
m <- flowmap ( demo_nodes , demo_flows , boundary = demo_boundary ,
weight = "population" , style = list ( title = "Daily commuting" ) )
print ( m )
#> <milkflow> 24 places (from 24 nodes), 25 segments, 5 width classes
#> Volume: 88,974 in 180 pairs (180 routed)
#> in corridors 98.1%
#> internal 1.9%
#> filtered out 0.0%
#> without a path 0.0%
#> Lines: 3 categories on 25 segments, 129 crossings at nodes
#> leisure 14.8% of the drawn volume
#> study 24.0% of the drawn volume
#> work 61.3% of the drawn volume
#> Detour: mean 1.10, max 5.09
The summary is the accounting of the map: every trip is
either drawn in a corridor, internal to a place, left out by the filter,
or without a path. In an HTML document the object prints as the
figure:
Daily commuting
98% do volume em 25 trechos · 2% interno aos lugares
work Marar → Quinmar: 3.341 Quinmar → Marar: 2.645 Total: 5.986 · 62% do
trecho
study Marar → Quinmar: 1.603 Quinmar → Marar: 681 Total: 2.284 · 24% do
trecho
leisure Marar → Quinmar: 613 Quinmar → Marar: 699 Total: 1.312 · 14% do
trecho
leisure Marar → Falir: 296 Falir → Marar: 630 Total: 926 · 18% do trecho
study Marar → Falir: 467 Falir → Marar: 627 Total: 1.094 · 22% do trecho
work Marar → Falir: 2.042 Falir → Marar: 953 Total: 2.995 · 60% do
trecho
work Marar → Arjun: 2.665 Arjun → Marar: 1.531 Total: 4.196 · 56% do
trecho
study Marar → Arjun: 951 Arjun → Marar: 971 Total: 1.922 · 26% do trecho
leisure Marar → Arjun: 734 Arjun → Marar: 673 Total: 1.407 · 19% do
trecho
leisure Marar → Kellor: 376 Kellor → Marar: 393 Total: 769 · 8% do
trecho
study Marar → Kellor: 2.172 Kellor → Marar: 719 Total: 2.891 · 31% do
trecho
work Marar → Kellor: 3.230 Kellor → Marar: 2.543 Total: 5.773 · 61% do
trecho
work Quinmar → Halbel: 2.436 Halbel → Quinmar: 2.006 Total: 4.442 · 66%
do trecho
study Quinmar → Halbel: 904 Halbel → Quinmar: 502 Total: 1.406 · 21% do
trecho
leisure Quinmar → Halbel: 378 Halbel → Quinmar: 539 Total: 917 · 14% do
trecho
work Halbel → Palhal: 2.135 Palhal → Halbel: 1.996 Total: 4.131 · 66% do
trecho
study Halbel → Palhal: 744 Palhal → Halbel: 502 Total: 1.246 · 20% do
trecho
leisure Halbel → Palhal: 368 Palhal → Halbel: 497 Total: 865 · 14% do
trecho
work Palhal → Salgor: 1.581 Salgor → Palhal: 1.692 Total: 3.273 · 63% do
trecho
study Palhal → Salgor: 637 Salgor → Palhal: 453 Total: 1.090 · 21% do
trecho
leisure Palhal → Salgor: 317 Salgor → Palhal: 515 Total: 832 · 16% do
trecho
work Lorkel → Salgor: 4.502 Salgor → Lorkel: 3.481 Total: 7.983 · 67% do
trecho
study Lorkel → Salgor: 1.443 Salgor → Lorkel: 974 Total: 2.417 · 20% do
trecho
leisure Lorkel → Salgor: 946 Salgor → Lorkel: 567 Total: 1.513 · 13% do
trecho
leisure Lorkel → Artor: 1.125 Artor → Lorkel: 278 Total: 1.403 · 24% do
trecho
study Lorkel → Artor: 1.062 Artor → Lorkel: 446 Total: 1.508 · 26% do
trecho
work Lorkel → Artor: 1.279 Artor → Lorkel: 1.587 Total: 2.866 · 50% do
trecho
leisure Lorkel → Quincor: 2.403 Quincor → Lorkel: 903 Total: 3.306 · 19%
do trecho
study Lorkel → Quincor: 1.476 Quincor → Lorkel: 2.511 Total: 3.987 · 23%
do trecho
work Lorkel → Quincor: 6.860 Quincor → Lorkel: 3.090 Total: 9.950 · 58%
do trecho
leisure Palquin → Salgor: 713 Salgor → Palquin: 383 Total: 1.096 · 13%
do trecho
study Palquin → Salgor: 783 Salgor → Palquin: 1.204 Total: 1.987 · 24%
do trecho
work Palquin → Salgor: 2.352 Salgor → Palquin: 2.955 Total: 5.307 · 63%
do trecho
work Palquin → Dalen: 2.120 Dalen → Palquin: 1.861 Total: 3.981 · 60% do
trecho
study Palquin → Dalen: 1.078 Dalen → Palquin: 743 Total: 1.821 · 27% do
trecho
leisure Palquin → Dalen: 362 Dalen → Palquin: 460 Total: 822 · 12% do
trecho
leisure Dalmar → Ostros: 1.292 Ostros → Dalmar: 372 Total: 1.664 · 18%
do trecho
study Dalmar → Ostros: 786 Ostros → Dalmar: 1.481 Total: 2.267 · 25% do
trecho
work Dalmar → Ostros: 2.729 Ostros → Dalmar: 2.400 Total: 5.129 · 57% do
trecho
work Dalmar → Quincor: 2.275 Quincor → Dalmar: 3.112 Total: 5.387 · 53%
do trecho
study Dalmar → Quincor: 1.425 Quincor → Dalmar: 1.153 Total: 2.578 · 25%
do trecho
leisure Dalmar → Quincor: 526 Quincor → Dalmar: 1.626 Total: 2.152 · 21%
do trecho
leisure Corbel → Dalen: 1.336 Dalen → Corbel: 519 Total: 1.855 · 12% do
trecho
study Corbel → Dalen: 1.712 Dalen → Corbel: 1.729 Total: 3.441 · 22% do
trecho
work Corbel → Dalen: 5.397 Dalen → Corbel: 5.137 Total: 10.534 · 67% do
trecho
leisure Corbel → Enlor: 586 Enlor → Corbel: 388 Total: 974 · 14% do
trecho
study Corbel → Enlor: 864 Enlor → Corbel: 1.082 Total: 1.946 · 28% do
trecho
work Corbel → Enlor: 2.148 Enlor → Corbel: 1.892 Total: 4.040 · 58% do
trecho
work Belpal → Falir: 897 Falir → Belpal: 1.669 Total: 2.566 · 58% do
trecho
study Belpal → Falir: 545 Falir → Belpal: 325 Total: 870 · 20% do trecho
leisure Belpal → Falir: 646 Falir → Belpal: 321 Total: 967 · 22% do
trecho
work Lorkel → Junmar: 1.917 Junmar → Lorkel: 1.193 Total: 3.110 · 69% do
trecho
study Lorkel → Junmar: 606 Junmar → Lorkel: 330 Total: 936 · 21% do
trecho
leisure Lorkel → Junmar: 192 Junmar → Lorkel: 255 Total: 447 · 10% do
trecho
work Corbel → Ostpal: 1.093 Ostpal → Corbel: 910 Total: 2.003 · 59% do
trecho
study Corbel → Ostpal: 528 Ostpal → Corbel: 287 Total: 815 · 24% do
trecho
leisure Corbel → Ostpal: 364 Ostpal → Corbel: 187 Total: 551 · 16% do
trecho
leisure Enlor → Norcor: 429 Norcor → Enlor: 242 Total: 671 · 14% do
trecho
study Enlor → Norcor: 373 Norcor → Enlor: 508 Total: 881 · 18% do trecho
work Enlor → Norcor: 1.642 Norcor → Enlor: 1.582 Total: 3.224 · 68% do
trecho
work Junmar → Ostros: 298 Ostros → Junmar: 374 Total: 672 · 51% do
trecho
study Junmar → Ostros: 174 Ostros → Junmar: 212 Total: 386 · 29% do
trecho
leisure Junmar → Ostros: 178 Ostros → Junmar: 82 Total: 260 · 20% do
trecho
work Ostpal → Tordal: 728 Tordal → Ostpal: 555 Total: 1.283 · 67% do
trecho
study Ostpal → Tordal: 203 Tordal → Ostpal: 218 Total: 421 · 22% do
trecho
leisure Ostpal → Tordal: 142 Tordal → Ostpal: 74 Total: 216 · 11% do
trecho
work Tordal → Norcor: 377 Norcor → Tordal: 567 Total: 944 · 71% do
trecho
study Tordal → Norcor: 160 Norcor → Tordal: 99 Total: 259 · 19% do
trecho
leisure Tordal → Norcor: 46 Norcor → Tordal: 85 Total: 131 · 10% do
trecho
leisure Marar → Torost: 17 Torost → Marar: 4 Total: 21 · 6% do trecho
study Marar → Torost: 115 Torost → Marar: 46 Total: 161 · 47% do trecho
work Marar → Torost: 102 Torost → Marar: 57 Total: 159 · 47% do trecho
leisure Dalen → Salpal: 74 Salpal → Dalen: 7 Total: 81 · 29% do trecho
study Dalen → Salpal: 13 Salpal → Dalen: 31 Total: 44 · 16% do trecho
work Dalen → Salpal: 106 Salpal → Dalen: 51 Total: 157 · 56% do trecho
Marar Origem e destino (desenhado): 24.178 Interno: 1.200
Belpal Origem e destino (desenhado): 4.403 Interno: 300
Quinmar Origem e destino (desenhado): 2.817 Interno: 150
Falir Origem e destino (desenhado): 1.056
Arjun Origem e destino (desenhado): 7.525
Halbel Origem e destino (desenhado): 1.109
Kellor Origem e destino (desenhado): 9.433
Torost Origem e destino (desenhado): 341
Palhal Origem e destino (desenhado): 1.835
Lorkel Origem e destino (desenhado): 32.960
Palquin Origem e destino (desenhado): 4.962
Junmar Origem e destino (desenhado): 5.811
Salgor Origem e destino (desenhado): 5.366
Dalmar Origem e destino (desenhado): 4.821
Artor Origem e destino (desenhado): 5.777
Ostros Origem e destino (desenhado): 9.776
Quincor Origem e destino (desenhado): 8.592
Corbel Origem e destino (desenhado): 15.837
Dalen Origem e destino (desenhado): 9.872
Enlor Origem e destino (desenhado): 6.930
Ostpal Origem e destino (desenhado): 3.199
Salpal Origem e destino (desenhado): 282
Tordal Origem e destino (desenhado): 2.460
Norcor Origem e destino (desenhado): 5.306
Lorkel Marar Corbel Dalen Ostros Kellor Quincor Arjun Enlor Junmar Artor Salgor Norcor Palquin Dalmar Belpal Ostpal Quinmar Tordal Palhal Halbel Falir Torost Salpal Daily
commuting Cor =
categoria leisure 13 mil study 21 mil work 54 mil origem e destino fluxo interno 98% do volume em 25 trechos · 2% interno aos
lugares
Use write_svg(m, "map.svg") to save it, or
plot(m) to open it in the RStudio Viewer or in a
browser.
Fewer, thicker corridors
mu trades ink against detours: smaller values keep fewer
segments. k sets how many of the largest pairs of each
place design the corridors.
few <- flowmap ( demo_nodes , demo_flows , mu = 0.5 , k = 2 )
c ( segments_default = nrow ( m $ spec $ segments ) , segments_few = nrow ( few $ spec $ segments ) )
#> segments_default segments_few
#> 25 23
Other filters
The pairs that design the corridors come from a filter; by default
the k largest of each place. filter picks
another (see the section “Filters” of ?flowmap ):
"dominant" keeps the largest flow of each town when it goes
to a larger one (Nystuen and Dacey’s dominant flows), a tree of each
town towards its centre. With represent = "all", the
default, every pair is still drawn, on the corridors that tree
designed.
dom <- flowmap ( demo_nodes , demo_flows , boundary = demo_boundary ,
weight = "population" , filter = "dominant" , lines = "off" ,
style = list ( title = "Corridors of the dominant flows" , lang = "en" ) )
dom $ spec $ meta $ params $ filter
#> $kind
#> [1] "dominant"
dom
Corridors of the dominant flows
98% of the volume in 23 segments · 2% internal to the places · 2
labels left out
Marar → Quinmar: 3,504 Quinmar → Marar: 1,847 Total: 5,351 · class 5
(5k–19k)
Marar → Falir: 4,148 Falir → Marar: 3,678 Total: 7,826 · class 5
(5k–19k)
Marar → Arjun: 4,350 Arjun → Marar: 3,175 Total: 7,525 · class 5
(5k–19k)
Marar → Kellor: 5,778 Kellor → Marar: 3,655 Total: 9,433 · class 5
(5k–19k)
Belpal → Falir: 3,556 Falir → Belpal: 3,658 Total: 7,214 · class 5
(5k–19k)
Belpal → Tordal: 2,535 Tordal → Belpal: 2,660 Total: 5,195 · class 5
(5k–19k)
Lorkel → Junmar: 3,383 Junmar → Lorkel: 2,428 Total: 5,811 · class 5
(5k–19k)
Lorkel → Salgor: 6,891 Salgor → Lorkel: 5,022 Total: 11,913 · class 5
(5k–19k)
Lorkel → Artor: 3,466 Artor → Lorkel: 2,311 Total: 5,777 · class 5
(5k–19k)
Lorkel → Quincor: 11,389 Quincor → Lorkel: 7,172 Total: 18,561 · class 5
(5k–19k)
Palquin → Salgor: 3,733 Salgor → Palquin: 4,552 Total: 8,285 · class 5
(5k–19k)
Palquin → Ostpal: 4,232 Ostpal → Palquin: 3,611 Total: 7,843 · class 5
(5k–19k)
Dalmar → Ostros: 5,156 Ostros → Dalmar: 4,620 Total: 9,776 · class 5
(5k–19k)
Dalmar → Quincor: 4,894 Quincor → Dalmar: 6,541 Total: 11,435 · class 5
(5k–19k)
Corbel → Dalen: 5,855 Dalen → Corbel: 4,299 Total: 10,154 · class 5
(5k–19k)
Corbel → Enlor: 4,181 Enlor → Corbel: 4,113 Total: 8,294 · class 5
(5k–19k)
Corbel → Ostpal: 4,393 Ostpal → Corbel: 4,120 Total: 8,513 · class 5
(5k–19k)
Enlor → Norcor: 2,625 Norcor → Enlor: 2,681 Total: 5,306 · class 5
(5k–19k)
Ostpal → Tordal: 3,822 Tordal → Ostpal: 3,303 Total: 7,125 · class 5
(5k–19k)
Quinmar → Halbel: 1,665 Halbel → Quinmar: 869 Total: 2,534 · class 4
(2k–5k)
Halbel → Palhal: 1,106 Palhal → Halbel: 729 Total: 1,835 · class 3
(1k–2k)
Marar → Torost: 234 Torost → Marar: 107 Total: 341 · class 1 (282–500)
Dalen → Salpal: 193 Salpal → Dalen: 89 Total: 282 · class 1 (282–500)
Marar Origin and destination (drawn): 24,178 Internal: 1,200
Belpal Origin and destination (drawn): 4,403 Internal: 300
Quinmar Origin and destination (drawn): 2,817 Internal: 150
Falir Origin and destination (drawn): 1,056
Arjun Origin and destination (drawn): 7,525
Halbel Origin and destination (drawn): 1,109
Kellor Origin and destination (drawn): 9,433
Torost Origin and destination (drawn): 341
Palhal Origin and destination (drawn): 1,835
Lorkel Origin and destination (drawn): 32,960
Palquin Origin and destination (drawn): 4,962
Junmar Origin and destination (drawn): 5,811
Salgor Origin and destination (drawn): 5,366
Dalmar Origin and destination (drawn): 4,821
Artor Origin and destination (drawn): 5,777
Ostros Origin and destination (drawn): 9,776
Quincor Origin and destination (drawn): 8,592
Corbel Origin and destination (drawn): 15,837
Dalen Origin and destination (drawn): 9,872
Enlor Origin and destination (drawn): 6,930
Ostpal Origin and destination (drawn): 3,199
Salpal Origin and destination (drawn): 282
Tordal Origin and destination (drawn): 2,460
Norcor Origin and destination (drawn): 5,306
Lorkel Marar Corbel Dalen Ostros Kellor Quincor Arjun Enlor Junmar Artor Salgor Norcor Palquin Belpal Ostpal Tordal Palhal Halbel Falir Torost Salpal Corridors
of the dominant flows Width =
volume 282–500 500–1k 1k–2k 2k–5k 5k–19k origin and destination internal flow 98% of the volume in 23 segments · 2% internal
to the places · 2 labels left out
Others are the disparity backbone
(list(kind = "disparity", alpha = 0.05)), the
n largest pairs, the largest pairs up to a share of the
volume, and a threshold. A sparse filter with
represent = "all" can send the pairs it left out on long
detours: when the largest detour is above 4 times the straight distance,
flowmap() warns and suggests
represent = "design", which draws only the pairs that
designed the corridors.
One line per category
When the flows have a category (the column category, or
the one named by category =), each corridor is split into
one line per category, as the lines of a metro share a track.
The routing and the widths do not change; the lines are a finer account
of the same corridors. The core orders the lines along each corridor so
that they cross little and continues each line from one segment to the
next. At most max_categories categories are kept; the
smallest ones go to “other”.
m $ spec $ legend $ categories
#> id label total
#> 1 leisure leisure 12883
#> 2 study study 20919
#> 3 work work 53522
head ( m $ spec $ lines [ , c ( "segment" , "position" , "label" , "flow_ab" , "flow_ba" ) ] )
#> segment position label flow_ab flow_ba
#> 1 0 1 work 3341 2645
#> 2 0 2 study 1603 681
#> 3 0 3 leisure 613 699
#> 4 1 1 leisure 296 630
#> 5 1 2 study 467 627
#> 6 1 3 work 2042 953
m$spec$lines is a long data frame, one row per line of a
segment; position 1 is the leftmost line for a traveller
going from end a to end b of the segment, the
list columns next_a and next_b give the
segments the line continues into, and ends_a,
ends_b the volume it stops at each end (a line may do both
at a place).
The figure draws the lines: one colour per category, joined from one
segment to the next at the nodes, and a legend of the categories. By
default every line has the same width, as on a metro map;
line_width = "flow" shares the width of the corridor’s
class among its lines by volume. line_colours sets the
colours and lang = "en" writes the legend in English:
lines <- flowmap ( demo_nodes , demo_flows , boundary = demo_boundary ,
weight = "population" ,
style = list ( title = "Commuting by purpose" , lang = "en" ,
line_colours = c ( "#1B9E77" , "#D95F02" , "#7570B3" ) ) )
lines
Commuting by purpose
98% of the volume in 25 segments · 2% internal to the
places
work Marar → Quinmar: 3,341 Quinmar → Marar: 2,645 Total: 5,986 · 62% of
the segment
study Marar → Quinmar: 1,603 Quinmar → Marar: 681 Total: 2,284 · 24% of
the segment
leisure Marar → Quinmar: 613 Quinmar → Marar: 699 Total: 1,312 · 14% of
the segment
leisure Marar → Falir: 296 Falir → Marar: 630 Total: 926 · 18% of the
segment
study Marar → Falir: 467 Falir → Marar: 627 Total: 1,094 · 22% of the
segment
work Marar → Falir: 2,042 Falir → Marar: 953 Total: 2,995 · 60% of the
segment
work Marar → Arjun: 2,665 Arjun → Marar: 1,531 Total: 4,196 · 56% of the
segment
study Marar → Arjun: 951 Arjun → Marar: 971 Total: 1,922 · 26% of the
segment
leisure Marar → Arjun: 734 Arjun → Marar: 673 Total: 1,407 · 19% of the
segment
leisure Marar → Kellor: 376 Kellor → Marar: 393 Total: 769 · 8% of the
segment
study Marar → Kellor: 2,172 Kellor → Marar: 719 Total: 2,891 · 31% of
the segment
work Marar → Kellor: 3,230 Kellor → Marar: 2,543 Total: 5,773 · 61% of
the segment
work Quinmar → Halbel: 2,436 Halbel → Quinmar: 2,006 Total: 4,442 · 66%
of the segment
study Quinmar → Halbel: 904 Halbel → Quinmar: 502 Total: 1,406 · 21% of
the segment
leisure Quinmar → Halbel: 378 Halbel → Quinmar: 539 Total: 917 · 14% of
the segment
work Halbel → Palhal: 2,135 Palhal → Halbel: 1,996 Total: 4,131 · 66% of
the segment
study Halbel → Palhal: 744 Palhal → Halbel: 502 Total: 1,246 · 20% of
the segment
leisure Halbel → Palhal: 368 Palhal → Halbel: 497 Total: 865 · 14% of
the segment
work Palhal → Salgor: 1,581 Salgor → Palhal: 1,692 Total: 3,273 · 63% of
the segment
study Palhal → Salgor: 637 Salgor → Palhal: 453 Total: 1,090 · 21% of
the segment
leisure Palhal → Salgor: 317 Salgor → Palhal: 515 Total: 832 · 16% of
the segment
work Lorkel → Salgor: 4,502 Salgor → Lorkel: 3,481 Total: 7,983 · 67% of
the segment
study Lorkel → Salgor: 1,443 Salgor → Lorkel: 974 Total: 2,417 · 20% of
the segment
leisure Lorkel → Salgor: 946 Salgor → Lorkel: 567 Total: 1,513 · 13% of
the segment
leisure Lorkel → Artor: 1,125 Artor → Lorkel: 278 Total: 1,403 · 24% of
the segment
study Lorkel → Artor: 1,062 Artor → Lorkel: 446 Total: 1,508 · 26% of
the segment
work Lorkel → Artor: 1,279 Artor → Lorkel: 1,587 Total: 2,866 · 50% of
the segment
leisure Lorkel → Quincor: 2,403 Quincor → Lorkel: 903 Total: 3,306 · 19%
of the segment
study Lorkel → Quincor: 1,476 Quincor → Lorkel: 2,511 Total: 3,987 · 23%
of the segment
work Lorkel → Quincor: 6,860 Quincor → Lorkel: 3,090 Total: 9,950 · 58%
of the segment
leisure Palquin → Salgor: 713 Salgor → Palquin: 383 Total: 1,096 · 13%
of the segment
study Palquin → Salgor: 783 Salgor → Palquin: 1,204 Total: 1,987 · 24%
of the segment
work Palquin → Salgor: 2,352 Salgor → Palquin: 2,955 Total: 5,307 · 63%
of the segment
work Palquin → Dalen: 2,120 Dalen → Palquin: 1,861 Total: 3,981 · 60% of
the segment
study Palquin → Dalen: 1,078 Dalen → Palquin: 743 Total: 1,821 · 27% of
the segment
leisure Palquin → Dalen: 362 Dalen → Palquin: 460 Total: 822 · 12% of
the segment
leisure Dalmar → Ostros: 1,292 Ostros → Dalmar: 372 Total: 1,664 · 18%
of the segment
study Dalmar → Ostros: 786 Ostros → Dalmar: 1,481 Total: 2,267 · 25% of
the segment
work Dalmar → Ostros: 2,729 Ostros → Dalmar: 2,400 Total: 5,129 · 57% of
the segment
work Dalmar → Quincor: 2,275 Quincor → Dalmar: 3,112 Total: 5,387 · 53%
of the segment
study Dalmar → Quincor: 1,425 Quincor → Dalmar: 1,153 Total: 2,578 · 25%
of the segment
leisure Dalmar → Quincor: 526 Quincor → Dalmar: 1,626 Total: 2,152 · 21%
of the segment
leisure Corbel → Dalen: 1,336 Dalen → Corbel: 519 Total: 1,855 · 12% of
the segment
study Corbel → Dalen: 1,712 Dalen → Corbel: 1,729 Total: 3,441 · 22% of
the segment
work Corbel → Dalen: 5,397 Dalen → Corbel: 5,137 Total: 10,534 · 67% of
the segment
leisure Corbel → Enlor: 586 Enlor → Corbel: 388 Total: 974 · 14% of the
segment
study Corbel → Enlor: 864 Enlor → Corbel: 1,082 Total: 1,946 · 28% of
the segment
work Corbel → Enlor: 2,148 Enlor → Corbel: 1,892 Total: 4,040 · 58% of
the segment
work Belpal → Falir: 897 Falir → Belpal: 1,669 Total: 2,566 · 58% of the
segment
study Belpal → Falir: 545 Falir → Belpal: 325 Total: 870 · 20% of the
segment
leisure Belpal → Falir: 646 Falir → Belpal: 321 Total: 967 · 22% of the
segment
work Lorkel → Junmar: 1,917 Junmar → Lorkel: 1,193 Total: 3,110 · 69% of
the segment
study Lorkel → Junmar: 606 Junmar → Lorkel: 330 Total: 936 · 21% of the
segment
leisure Lorkel → Junmar: 192 Junmar → Lorkel: 255 Total: 447 · 10% of
the segment
work Corbel → Ostpal: 1,093 Ostpal → Corbel: 910 Total: 2,003 · 59% of
the segment
study Corbel → Ostpal: 528 Ostpal → Corbel: 287 Total: 815 · 24% of the
segment
leisure Corbel → Ostpal: 364 Ostpal → Corbel: 187 Total: 551 · 16% of
the segment
leisure Enlor → Norcor: 429 Norcor → Enlor: 242 Total: 671 · 14% of the
segment
study Enlor → Norcor: 373 Norcor → Enlor: 508 Total: 881 · 18% of the
segment
work Enlor → Norcor: 1,642 Norcor → Enlor: 1,582 Total: 3,224 · 68% of
the segment
work Junmar → Ostros: 298 Ostros → Junmar: 374 Total: 672 · 51% of the
segment
study Junmar → Ostros: 174 Ostros → Junmar: 212 Total: 386 · 29% of the
segment
leisure Junmar → Ostros: 178 Ostros → Junmar: 82 Total: 260 · 20% of the
segment
work Ostpal → Tordal: 728 Tordal → Ostpal: 555 Total: 1,283 · 67% of the
segment
study Ostpal → Tordal: 203 Tordal → Ostpal: 218 Total: 421 · 22% of the
segment
leisure Ostpal → Tordal: 142 Tordal → Ostpal: 74 Total: 216 · 11% of the
segment
work Tordal → Norcor: 377 Norcor → Tordal: 567 Total: 944 · 71% of the
segment
study Tordal → Norcor: 160 Norcor → Tordal: 99 Total: 259 · 19% of the
segment
leisure Tordal → Norcor: 46 Norcor → Tordal: 85 Total: 131 · 10% of the
segment
leisure Marar → Torost: 17 Torost → Marar: 4 Total: 21 · 6% of the
segment
study Marar → Torost: 115 Torost → Marar: 46 Total: 161 · 47% of the
segment
work Marar → Torost: 102 Torost → Marar: 57 Total: 159 · 47% of the
segment
leisure Dalen → Salpal: 74 Salpal → Dalen: 7 Total: 81 · 29% of the
segment
study Dalen → Salpal: 13 Salpal → Dalen: 31 Total: 44 · 16% of the
segment
work Dalen → Salpal: 106 Salpal → Dalen: 51 Total: 157 · 56% of the
segment
Marar Origin and destination (drawn): 24,178 Internal: 1,200
Belpal Origin and destination (drawn): 4,403 Internal: 300
Quinmar Origin and destination (drawn): 2,817 Internal: 150
Falir Origin and destination (drawn): 1,056
Arjun Origin and destination (drawn): 7,525
Halbel Origin and destination (drawn): 1,109
Kellor Origin and destination (drawn): 9,433
Torost Origin and destination (drawn): 341
Palhal Origin and destination (drawn): 1,835
Lorkel Origin and destination (drawn): 32,960
Palquin Origin and destination (drawn): 4,962
Junmar Origin and destination (drawn): 5,811
Salgor Origin and destination (drawn): 5,366
Dalmar Origin and destination (drawn): 4,821
Artor Origin and destination (drawn): 5,777
Ostros Origin and destination (drawn): 9,776
Quincor Origin and destination (drawn): 8,592
Corbel Origin and destination (drawn): 15,837
Dalen Origin and destination (drawn): 9,872
Enlor Origin and destination (drawn): 6,930
Ostpal Origin and destination (drawn): 3,199
Salpal Origin and destination (drawn): 282
Tordal Origin and destination (drawn): 2,460
Norcor Origin and destination (drawn): 5,306
Lorkel Marar Corbel Dalen Ostros Kellor Quincor Arjun Enlor Junmar Artor Salgor Norcor Palquin Dalmar Belpal Ostpal Quinmar Tordal Palhal Halbel Falir Torost Salpal Commuting
by purpose Colour =
category leisure 13k study 21k work 54k origin and destination internal flow 98% of the volume in 25 segments · 2% internal
to the places
style = list(lines = "off") draws the corridors as one
band and keeps the lines in the specification;
lines = "off" (the argument) ignores the categories
altogether.
Themes and other styles
style is a list of drawing options passed to the core
(see the section “Style” of ?flowmap ): a theme
("light", "dark", "print",
"basemap"), a palette, one lane per direction, rails,
smooth corners, square places, and so on.
dark <- flowmap ( demo_nodes , demo_flows , boundary = demo_boundary ,
lines = "off" ,
style = list ( theme = "dark" , palette = "amber" ,
directions = "split" , corners = "smooth" ,
title = "Daily commuting, one lane per direction" ) )
dark
Daily commuting, one lane per direction
98% do volume em 25 trechos · 2% interno aos lugares
Marar → Quinmar: 5.557 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 9.582 · classe 5 (5 mil–17 mil)
Quinmar → Marar: 4.025 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 9.582 · classe 5 (5 mil–17 mil)
Marar → Falir: 2.805 · classe 4 (2 mil–5 mil) Trecho, nos dois sentidos:
5.015 · classe 5 (5 mil–17 mil)
Falir → Marar: 2.210 · classe 4 (2 mil–5 mil) Trecho, nos dois sentidos:
5.015 · classe 5 (5 mil–17 mil)
Marar → Arjun: 4.350 · classe 4 (2 mil–5 mil) Trecho, nos dois sentidos:
7.525 · classe 5 (5 mil–17 mil)
Arjun → Marar: 3.175 · classe 4 (2 mil–5 mil) Trecho, nos dois sentidos:
7.525 · classe 5 (5 mil–17 mil)
Marar → Kellor: 5.778 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 9.433 · classe 5 (5 mil–17 mil)
Kellor → Marar: 3.655 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 9.433 · classe 5 (5 mil–17 mil)
Quinmar → Halbel: 3.718 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 6.765 · classe 5 (5 mil–17 mil)
Halbel → Quinmar: 3.047 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 6.765 · classe 5 (5 mil–17 mil)
Halbel → Palhal: 3.247 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 6.242 · classe 5 (5 mil–17 mil)
Palhal → Halbel: 2.995 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 6.242 · classe 5 (5 mil–17 mil)
Palhal → Salgor: 2.535 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 5.195 · classe 5 (5 mil–17 mil)
Salgor → Palhal: 2.660 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 5.195 · classe 5 (5 mil–17 mil)
Lorkel → Salgor: 6.891 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 11.913 · classe 5 (5 mil–17 mil)
Salgor → Lorkel: 5.022 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 11.913 · classe 5 (5 mil–17 mil)
Lorkel → Artor: 3.466 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 5.777 · classe 5 (5 mil–17 mil)
Artor → Lorkel: 2.311 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 5.777 · classe 5 (5 mil–17 mil)
Lorkel → Quincor: 10.739 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 17.243 · classe 5 (5 mil–17 mil)
Quincor → Lorkel: 6.504 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 17.243 · classe 5 (5 mil–17 mil)
Palquin → Salgor: 3.848 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 8.390 · classe 5 (5 mil–17 mil)
Salgor → Palquin: 4.542 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 8.390 · classe 5 (5 mil–17 mil)
Palquin → Dalen: 3.560 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 6.624 · classe 5 (5 mil–17 mil)
Dalen → Palquin: 3.064 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 6.624 · classe 5 (5 mil–17 mil)
Dalmar → Ostros: 4.807 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 9.060 · classe 5 (5 mil–17 mil)
Ostros → Dalmar: 4.253 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 9.060 · classe 5 (5 mil–17 mil)
Dalmar → Quincor: 4.226 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 10.117 · classe 5 (5 mil–17 mil)
Quincor → Dalmar: 5.891 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 10.117 · classe 5 (5 mil–17 mil)
Corbel → Dalen: 8.445 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 15.830 · classe 5 (5 mil–17 mil)
Dalen → Corbel: 7.385 · classe 5 (5 mil–17 mil) Trecho, nos dois
sentidos: 15.830 · classe 5 (5 mil–17 mil)
Corbel → Enlor: 3.598 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 6.960 · classe 5 (5 mil–17 mil)
Enlor → Corbel: 3.362 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 6.960 · classe 5 (5 mil–17 mil)
Belpal → Falir: 2.088 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 4.403 · classe 4 (2 mil–5 mil)
Falir → Belpal: 2.315 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 4.403 · classe 4 (2 mil–5 mil)
Lorkel → Junmar: 2.715 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 4.493 · classe 4 (2 mil–5 mil)
Junmar → Lorkel: 1.778 · classe 3 (1 mil–2 mil) Trecho, nos dois
sentidos: 4.493 · classe 4 (2 mil–5 mil)
Corbel → Ostpal: 1.985 · classe 3 (1 mil–2 mil) Trecho, nos dois
sentidos: 3.369 · classe 4 (2 mil–5 mil)
Ostpal → Corbel: 1.384 · classe 3 (1 mil–2 mil) Trecho, nos dois
sentidos: 3.369 · classe 4 (2 mil–5 mil)
Enlor → Norcor: 2.444 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 4.776 · classe 4 (2 mil–5 mil)
Norcor → Enlor: 2.332 · classe 4 (2 mil–5 mil) Trecho, nos dois
sentidos: 4.776 · classe 4 (2 mil–5 mil)
Junmar → Ostros: 650 · classe 2 (500–1 mil) Trecho, nos dois sentidos:
1.318 · classe 3 (1 mil–2 mil)
Ostros → Junmar: 668 · classe 2 (500–1 mil) Trecho, nos dois sentidos:
1.318 · classe 3 (1 mil–2 mil)
Ostpal → Tordal: 1.073 · classe 3 (1 mil–2 mil) Trecho, nos dois
sentidos: 1.920 · classe 3 (1 mil–2 mil)
Tordal → Ostpal: 847 · classe 2 (500–1 mil) Trecho, nos dois sentidos:
1.920 · classe 3 (1 mil–2 mil)
Tordal → Norcor: 583 · classe 2 (500–1 mil) Trecho, nos dois sentidos:
1.334 · classe 3 (1 mil–2 mil)
Norcor → Tordal: 751 · classe 2 (500–1 mil) Trecho, nos dois sentidos:
1.334 · classe 3 (1 mil–2 mil)
Marar → Torost: 234 · abaixo da classe 1 Trecho, nos dois sentidos: 341
· classe 1 (282–500)
Torost → Marar: 107 · abaixo da classe 1 Trecho, nos dois sentidos: 341
· classe 1 (282–500)
Dalen → Salpal: 193 · abaixo da classe 1 Trecho, nos dois sentidos: 282
· classe 1 (282–500)
Salpal → Dalen: 89 · abaixo da classe 1 Trecho, nos dois sentidos: 282 ·
classe 1 (282–500)
Marar Origem e destino (desenhado): 24.178 Interno: 1.200
Belpal Origem e destino (desenhado): 4.403 Interno: 300
Quinmar Origem e destino (desenhado): 2.817 Interno: 150
Falir Origem e destino (desenhado): 1.056
Arjun Origem e destino (desenhado): 7.525
Halbel Origem e destino (desenhado): 1.109
Kellor Origem e destino (desenhado): 9.433
Torost Origem e destino (desenhado): 341
Palhal Origem e destino (desenhado): 1.835
Lorkel Origem e destino (desenhado): 32.960
Palquin Origem e destino (desenhado): 4.962
Junmar Origem e destino (desenhado): 5.811
Salgor Origem e destino (desenhado): 5.366
Dalmar Origem e destino (desenhado): 4.821
Artor Origem e destino (desenhado): 5.777
Ostros Origem e destino (desenhado): 9.776
Quincor Origem e destino (desenhado): 8.592
Corbel Origem e destino (desenhado): 15.837
Dalen Origem e destino (desenhado): 9.872
Enlor Origem e destino (desenhado): 6.930
Ostpal Origem e destino (desenhado): 3.199
Salpal Origem e destino (desenhado): 282
Tordal Origem e destino (desenhado): 2.460
Norcor Origem e destino (desenhado): 5.306
Lorkel Marar Corbel Dalen Ostros Kellor Quincor Arjun Enlor Junmar Artor Salgor Norcor Palquin Dalmar Belpal Ostpal Quinmar Tordal Palhal Halbel Falir Torost Salpal Daily
commuting, one lane per direction Espessura =
volume 282–500 500–1 mil 1 mil–2 mil 2 mil–5 mil 5 mil–17 mil cada faixa é um sentido; mão direita origem e destino fluxo interno 98% do volume em 25 trechos · 2% interno aos
lugares
Groups, at several levels
With group, nodes are merged into their groups first;
flows inside a group become internal volume. group names a
column of nodes, so one table can hold several nested
levels and each call draws one of them. Here the towns get a coarser
level, two regions, next to their district:
towns <- demo_nodes
towns $ region <- ifelse ( towns $ district == "Coast" , "Shore" , "Upland" )
g <- flowmap ( towns , demo_flows , group = "district" , weight = "population" )
r <- flowmap ( towns , demo_flows , group = "region" , weight = "population" )
g
Mapa de fluxos
11% do volume em 3 trechos · 89% interno aos grupos
leisure Coast → North: 366 North → Coast: 204 Total: 570 · 18% do trecho
study Coast → North: 292 North → Coast: 355 Total: 647 · 20% do trecho
work Coast → North: 1.109 North → Coast: 881 Total: 1.990 · 62% do
trecho
leisure Coast → Valley: 249 Valley → Coast: 311 Total: 560 · 12% do
trecho
study Coast → Valley: 796 Valley → Coast: 582 Total: 1.378 · 30% do
trecho
work Coast → Valley: 1.420 Valley → Coast: 1.278 Total: 2.698 · 58% do
trecho
leisure North → Valley: 113 Valley → North: 149 Total: 262 · 13% do
trecho
study North → Valley: 282 Valley → North: 161 Total: 443 · 22% do trecho
work North → Valley: 700 Valley → North: 583 Total: 1.283 · 65% do
trecho
Coast Origem e destino (desenhado): 7.843 Interno: 35.111 Agrega 8 nós
North Origem e destino (desenhado): 5.195 Interno: 25.401 Agrega 9 nós
Valley Origem e destino (desenhado): 6.624 Interno: 18.631 Agrega 7 nós
Coast North Valley Cor =
categoria leisure 1,4 mil study 2,5 mil work 6 mil origem e destino fluxo interno 11% do volume em 3 trechos · 89% interno aos
grupos
The accounting closes at every level, and as the levels nest the
internal volume grows from towns to districts to regions:
levels <- list ( towns = m , district = g , region = r )
t ( sapply ( levels , function ( x ) unlist ( x $ spec $ meta $ accounting [ c ( "total" , "routed" , "internal" ) ] ) ) )
#> total routed internal
#> towns 88974 87324 1650
#> district 88974 9831 79143
#> region 88974 7843 81131
r $ spec $ meta $ params $ group
#> [1] "region"
A schematic layout
schematic = TRUE also computes an octilinear,
transit-map layout. Runs of nodes with two segments, like stations along
a line, are laid out as one path between their ends with the nodes set
along it. When no valid layout exists the reason is reported in
$schematic_error and the geographic map still stands.
s <- flowmap ( demo_nodes , demo_flows , schematic = TRUE )
if ( ! is.null ( s $ schematic_svg ) ) {
knitr :: asis_output ( sub ( "^<\\?xml[^>]*>\\s*" , "" , s $ schematic_svg ) )
}
Mapa de fluxos
98% do volume em 25 trechos · 2% interno aos lugares
work Marar → Quinmar: 3.341 Quinmar → Marar: 2.645 Total: 5.986 · 62% do
trecho
study Marar → Quinmar: 1.603 Quinmar → Marar: 681 Total: 2.284 · 24% do
trecho
leisure Marar → Quinmar: 613 Quinmar → Marar: 699 Total: 1.312 · 14% do
trecho
leisure Marar → Falir: 296 Falir → Marar: 630 Total: 926 · 18% do trecho
study Marar → Falir: 467 Falir → Marar: 627 Total: 1.094 · 22% do trecho
work Marar → Falir: 2.042 Falir → Marar: 953 Total: 2.995 · 60% do
trecho
work Marar → Arjun: 2.665 Arjun → Marar: 1.531 Total: 4.196 · 56% do
trecho
study Marar → Arjun: 951 Arjun → Marar: 971 Total: 1.922 · 26% do trecho
leisure Marar → Arjun: 734 Arjun → Marar: 673 Total: 1.407 · 19% do
trecho
leisure Marar → Kellor: 376 Kellor → Marar: 393 Total: 769 · 8% do
trecho
study Marar → Kellor: 2.172 Kellor → Marar: 719 Total: 2.891 · 31% do
trecho
work Marar → Kellor: 3.230 Kellor → Marar: 2.543 Total: 5.773 · 61% do
trecho
work Quinmar → Halbel: 2.436 Halbel → Quinmar: 2.006 Total: 4.442 · 66%
do trecho
study Quinmar → Halbel: 904 Halbel → Quinmar: 502 Total: 1.406 · 21% do
trecho
leisure Quinmar → Halbel: 378 Halbel → Quinmar: 539 Total: 917 · 14% do
trecho
work Halbel → Palhal: 2.135 Palhal → Halbel: 1.996 Total: 4.131 · 66% do
trecho
study Halbel → Palhal: 744 Palhal → Halbel: 502 Total: 1.246 · 20% do
trecho
leisure Halbel → Palhal: 368 Palhal → Halbel: 497 Total: 865 · 14% do
trecho
work Palhal → Salgor: 1.581 Salgor → Palhal: 1.692 Total: 3.273 · 63% do
trecho
study Palhal → Salgor: 637 Salgor → Palhal: 453 Total: 1.090 · 21% do
trecho
leisure Palhal → Salgor: 317 Salgor → Palhal: 515 Total: 832 · 16% do
trecho
work Lorkel → Salgor: 4.502 Salgor → Lorkel: 3.481 Total: 7.983 · 67% do
trecho
study Lorkel → Salgor: 1.443 Salgor → Lorkel: 974 Total: 2.417 · 20% do
trecho
leisure Lorkel → Salgor: 946 Salgor → Lorkel: 567 Total: 1.513 · 13% do
trecho
leisure Lorkel → Artor: 1.125 Artor → Lorkel: 278 Total: 1.403 · 24% do
trecho
study Lorkel → Artor: 1.062 Artor → Lorkel: 446 Total: 1.508 · 26% do
trecho
work Lorkel → Artor: 1.279 Artor → Lorkel: 1.587 Total: 2.866 · 50% do
trecho
leisure Lorkel → Quincor: 2.403 Quincor → Lorkel: 903 Total: 3.306 · 19%
do trecho
study Lorkel → Quincor: 1.476 Quincor → Lorkel: 2.511 Total: 3.987 · 23%
do trecho
work Lorkel → Quincor: 6.860 Quincor → Lorkel: 3.090 Total: 9.950 · 58%
do trecho
leisure Palquin → Salgor: 713 Salgor → Palquin: 383 Total: 1.096 · 13%
do trecho
study Palquin → Salgor: 783 Salgor → Palquin: 1.204 Total: 1.987 · 24%
do trecho
work Palquin → Salgor: 2.352 Salgor → Palquin: 2.955 Total: 5.307 · 63%
do trecho
work Palquin → Dalen: 2.120 Dalen → Palquin: 1.861 Total: 3.981 · 60% do
trecho
study Palquin → Dalen: 1.078 Dalen → Palquin: 743 Total: 1.821 · 27% do
trecho
leisure Palquin → Dalen: 362 Dalen → Palquin: 460 Total: 822 · 12% do
trecho
leisure Dalmar → Ostros: 1.292 Ostros → Dalmar: 372 Total: 1.664 · 18%
do trecho
study Dalmar → Ostros: 786 Ostros → Dalmar: 1.481 Total: 2.267 · 25% do
trecho
work Dalmar → Ostros: 2.729 Ostros → Dalmar: 2.400 Total: 5.129 · 57% do
trecho
work Dalmar → Quincor: 2.275 Quincor → Dalmar: 3.112 Total: 5.387 · 53%
do trecho
study Dalmar → Quincor: 1.425 Quincor → Dalmar: 1.153 Total: 2.578 · 25%
do trecho
leisure Dalmar → Quincor: 526 Quincor → Dalmar: 1.626 Total: 2.152 · 21%
do trecho
leisure Corbel → Dalen: 1.336 Dalen → Corbel: 519 Total: 1.855 · 12% do
trecho
study Corbel → Dalen: 1.712 Dalen → Corbel: 1.729 Total: 3.441 · 22% do
trecho
work Corbel → Dalen: 5.397 Dalen → Corbel: 5.137 Total: 10.534 · 67% do
trecho
leisure Corbel → Enlor: 586 Enlor → Corbel: 388 Total: 974 · 14% do
trecho
study Corbel → Enlor: 864 Enlor → Corbel: 1.082 Total: 1.946 · 28% do
trecho
work Corbel → Enlor: 2.148 Enlor → Corbel: 1.892 Total: 4.040 · 58% do
trecho
work Belpal → Falir: 897 Falir → Belpal: 1.669 Total: 2.566 · 58% do
trecho
study Belpal → Falir: 545 Falir → Belpal: 325 Total: 870 · 20% do trecho
leisure Belpal → Falir: 646 Falir → Belpal: 321 Total: 967 · 22% do
trecho
work Lorkel → Junmar: 1.917 Junmar → Lorkel: 1.193 Total: 3.110 · 69% do
trecho
study Lorkel → Junmar: 606 Junmar → Lorkel: 330 Total: 936 · 21% do
trecho
leisure Lorkel → Junmar: 192 Junmar → Lorkel: 255 Total: 447 · 10% do
trecho
work Corbel → Ostpal: 1.093 Ostpal → Corbel: 910 Total: 2.003 · 59% do
trecho
study Corbel → Ostpal: 528 Ostpal → Corbel: 287 Total: 815 · 24% do
trecho
leisure Corbel → Ostpal: 364 Ostpal → Corbel: 187 Total: 551 · 16% do
trecho
leisure Enlor → Norcor: 429 Norcor → Enlor: 242 Total: 671 · 14% do
trecho
study Enlor → Norcor: 373 Norcor → Enlor: 508 Total: 881 · 18% do trecho
work Enlor → Norcor: 1.642 Norcor → Enlor: 1.582 Total: 3.224 · 68% do
trecho
work Junmar → Ostros: 298 Ostros → Junmar: 374 Total: 672 · 51% do
trecho
study Junmar → Ostros: 174 Ostros → Junmar: 212 Total: 386 · 29% do
trecho
leisure Junmar → Ostros: 178 Ostros → Junmar: 82 Total: 260 · 20% do
trecho
work Ostpal → Tordal: 728 Tordal → Ostpal: 555 Total: 1.283 · 67% do
trecho
study Ostpal → Tordal: 203 Tordal → Ostpal: 218 Total: 421 · 22% do
trecho
leisure Ostpal → Tordal: 142 Tordal → Ostpal: 74 Total: 216 · 11% do
trecho
work Tordal → Norcor: 377 Norcor → Tordal: 567 Total: 944 · 71% do
trecho
study Tordal → Norcor: 160 Norcor → Tordal: 99 Total: 259 · 19% do
trecho
leisure Tordal → Norcor: 46 Norcor → Tordal: 85 Total: 131 · 10% do
trecho
leisure Marar → Torost: 17 Torost → Marar: 4 Total: 21 · 6% do trecho
study Marar → Torost: 115 Torost → Marar: 46 Total: 161 · 47% do trecho
work Marar → Torost: 102 Torost → Marar: 57 Total: 159 · 47% do trecho
leisure Dalen → Salpal: 74 Salpal → Dalen: 7 Total: 81 · 29% do trecho
study Dalen → Salpal: 13 Salpal → Dalen: 31 Total: 44 · 16% do trecho
work Dalen → Salpal: 106 Salpal → Dalen: 51 Total: 157 · 56% do trecho
Marar Origem e destino (desenhado): 24.178 Interno: 1.200
Belpal Origem e destino (desenhado): 4.403 Interno: 300
Quinmar Origem e destino (desenhado): 2.817 Interno: 150
Falir Origem e destino (desenhado): 1.056
Arjun Origem e destino (desenhado): 7.525
Halbel Origem e destino (desenhado): 1.109
Kellor Origem e destino (desenhado): 9.433
Torost Origem e destino (desenhado): 341
Palhal Origem e destino (desenhado): 1.835
Lorkel Origem e destino (desenhado): 32.960
Palquin Origem e destino (desenhado): 4.962
Junmar Origem e destino (desenhado): 5.811
Salgor Origem e destino (desenhado): 5.366
Dalmar Origem e destino (desenhado): 4.821
Artor Origem e destino (desenhado): 5.777
Ostros Origem e destino (desenhado): 9.776
Quincor Origem e destino (desenhado): 8.592
Corbel Origem e destino (desenhado): 15.837
Dalen Origem e destino (desenhado): 9.872
Enlor Origem e destino (desenhado): 6.930
Ostpal Origem e destino (desenhado): 3.199
Salpal Origem e destino (desenhado): 282
Tordal Origem e destino (desenhado): 2.460
Norcor Origem e destino (desenhado): 5.306
Lorkel Marar Corbel Dalen Ostros Kellor Quincor Arjun Enlor Junmar Artor Salgor Norcor Palquin Dalmar Belpal Ostpal Quinmar Tordal Palhal Halbel Falir Torost Salpal Cor =
categoria leisure 13 mil study 21 mil work 54 mil origem e destino fluxo interno 98% do volume em 25 trechos · 2% interno aos
lugares
Corridors of your own
With skeleton_source = "input" the corridors are the
ones you give, such as a road network. Its crossroads, where no flow
starts or ends, are junctions : drawn as small dots, never as
places, and counted in the metrics.
roads_nodes <- data.frame (
id = c ( "a" , "b" , "c" , "d" , "x" , "y" ) ,
x = c ( 0 , 10 , 20 , 10 , 10 , 15 ) , y = c ( 10 , 20 , 10 , 0 , 10 , 15 )
)
roads <- data.frame ( from = c ( "a" , "x" , "y" , "y" , "x" ) , to = c ( "x" , "y" , "b" , "c" , "d" ) )
trips <- data.frame ( origin = c ( "a" , "b" , "a" ) , destination = c ( "c" , "d" , "b" ) , value = c ( 5 , 3 , 1 ) )
j <- flowmap ( roads_nodes , trips , skeleton = roads , skeleton_source = "input" )
j $ spec $ nodes [ , c ( "id" , "kind" , "size" ) ]
#> id kind size
#> 1 a place 6
#> 2 b place 4
#> 3 c place 5
#> 4 d place 3
#> 5 x junction 0
#> 6 y junction 0
j $ spec $ meta $ metrics $ junctions
#> [1] 2
TikZ, for LaTeX
With tikz = TRUE the figures are also written as TikZ
pictures. A picture is drawn from the same scene as the SVG figure
(corridors, lines of the categories, places, labels, legend, theme), but
its text is typeset by LaTeX in the font of the document:
t <- flowmap ( demo_nodes , demo_flows , tikz = TRUE , style = list ( theme = "print" ) )
cat ( head ( strsplit ( t $ tikz , "\n" ) [[ 1 ] ] , 4 ) , sep = "\n" )
#> % milkflow 0.1 TikZ figure (geographic): 14.00 x 12.79 cm, 24 places, 25 segments, 24 labels.
#> % Drawn from the same scene as the SVG (milkflow chapter 12). Needs only \usepackage{tikz};
#> % restyle with \tikzset{milkflow label/.style={...}} etc. Not in a TikZ figure: the SVG's
#> % tooltips and data hooks (interactive only); label halos are filled boxes; label widths
write_tikz(t, "map.tex") saves it, for
\input{map.tex} in a document that loads
tikz.
An interactive page
With html = TRUE the result also holds
$html, one self-contained HTML file (no network, no
library) with the figure: pointing at a place, a corridor or a line
shows its numbers, and clicking one focuses the map on the flows through
it. write_html(p, "map.html") saves it.
p <- flowmap ( demo_nodes , demo_flows , html = TRUE , style = list ( lang = "en" ) )
nchar ( p $ html )
#> [1] 186662
Coordinates
The core works in planar coordinates. With ‘sf’, pass projected
points directly:
flowmap(st_transform(towns, 31985), flows);
longitude/latitude is refused with a message.
The same bytes everywhere
flowmap_json() is the JSON door of the Rust library: the
same input and options give the same output, byte for byte, in R, in
Rust and in the other bindings. m$json holds that
output.