Debian Codegraph @

texmf-dist/doc/latex/datatool/datatool-user-examples/datatool-user-example160.tex

raw
1 % This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
2 % Example 160 Scatter Plot with Legend Label Mappings (Two Databases, Multiple Sets of Data)
3 % Label: "ex:growthscatter6col2dbmap"
4 % arara: pdflatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 \usepackage{scontents}% to write test file with TABs preserved
9 \begin{scontents}[write-out={growth.tsv},overwrite]
10 Experiment 1 Experiment 2
11 Time Log Count Time Log Count
12 0 2.9 0 3.31
13 15 3.14 10 3.45
14 30 3.26 25 3.61
15 45 4.01 40 3.76
16 60 4.2 55 3.89
17 \end{scontents}
18
19 \begin{scontents}[write-out={growth2.tsv},overwrite]
20 Experiment 1 Experiment 2 Experiment 3
21 Time Log Count Time Log Count Time Log Count
22 0 3.21 0 3.39 0 3.28
23 15 3.43 10 3.51 10 3.45
24 30 3.68 25 3.65 20 3.57
25 45 4.4 40 3.84 30 3.64
26 60 4.8 55 3.92 40 3.95
27 \end{scontents}
28
29 \usepackage{dataplot}
30 \usepackage{siunitx}
31 \DTLsetup{store-datum}
32 \DTLread[
33 name=growthdata, format=tsv,csv-skip-lines=1,
34 keys={Exp1Time,Exp1Count,Exp2Time,Exp2Count},
35 csv-content=no-parse,
36 data-types=decimal
37 ]{growth}% growth.tsv
38
39 \DTLread[
40 name=growthdata2, format=tsv,csv-skip-lines=1,
41 keys={Exp1Time,Exp1Count,Exp2Time,Exp2Count,Exp3Time,Exp3Count},
42 csv-content=no-parse,
43 data-types=decimal
44 ]{growth2}% growth2.tsv
45
46
47 \DTLplotlegendsetname{growthdata}{\qty{6}{\degreeCelsius}}
48 \DTLplotlegendsetname{growthdata2}{\qty{8}{\degreeCelsius}}
49 \DTLplotlegendsetxlabel{Exp1Time}{$t_1$}
50 \DTLplotlegendsetxlabel{Exp2Time}{$t_2$}
51 \DTLplotlegendsetxlabel{Exp3Time}{$t_3$}
52 \DTLplotlegendsetylabel{Exp1Count}{$N_1$}
53 \DTLplotlegendsetylabel{Exp2Count}{$N_2$}
54 \DTLplotlegendsetylabel{Exp3Count}{$N_3$}
55 \begin{document}
56 \DTLplot{growthdata,growthdata2}{
57 x={Exp1Time,Exp2Time,Exp3Time},
58 y={Exp1Count,Exp2Count,Exp3Count},
59 x-label={Time ($t$)},y-label={Log Count},
60 legend,
61 width=2.5in,height=2.5in
62 }
63 \end{document}