Writes the figure as a bare tikzpicture, to be \input in a LaTeX
document that loads tikz (\usepackage{tikz}; no other package or TikZ
library). The picture is drawn from the same scene as the SVG figure:
the same corridors (solid bands, split lanes, rails), the lines of the
categories and their connectors, junctions, places, the ends at the
edge of a map framed on the boundary, the labels in the same positions,
the legend and the honesty line in the language of the style, with the
same theme, palette, opacities and corners. The text (labels, title,
legend, honesty line) is typeset by LaTeX in the sans-serif family of the
document; its placement uses estimated widths, so a document whose sans
is much wider than Helvetica may make neighbouring labels touch. Each
element has a named TikZ style (milkflow label, milkflow corridor,
milkflow line, ...) that the document can redefine with \tikzset.
Tooltips and the hooks of the interactive page are not written. The
picture is 14 cm wide (at most 20 cm tall). Needs flowmap(..., tikz = TRUE).
Arguments
- x
A
milkflowobject fromflowmap().- file
Path of the file to write.
- schematic
Write the schematic layout instead of the geographic one; an error when there is none.
Examples
m <- flowmap(demo_nodes, demo_flows, tikz = TRUE, style = list(theme = "print"))
f <- tempfile(fileext = ".tex")
write_tikz(m, f)
readLines(f, n = 3)
#> [1] "% milkflow 0.1 TikZ figure (geographic): 14.00 x 12.79 cm, 24 places, 25 segments, 24 labels."
#> [2] "% Drawn from the same scene as the SVG (milkflow chapter 12). Needs only \\usepackage{tikz};"
#> [3] "% restyle with \\tikzset{milkflow label/.style={...}} etc. Not in a TikZ figure: the SVG's"
unlink(f)