| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 162 Scatter Plot with Custom Legend Labels (Two Databases, Multiple Sets of Data) |
| 3 |
% Label: "ex:growthscatter6col2dbmap2" |
| 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 |
\DTLsetup{store-datum} |
| 31 |
\DTLread[ |
| 32 |
name=growthdata, format=tsv,csv-skip-lines=1, |
| 33 |
keys={Exp1Time,Exp1Count,Exp2Time,Exp2Count}, |
| 34 |
csv-content=no-parse, |
| 35 |
data-types=decimal |
| 36 |
]{growth}% growth.tsv |
| 37 |
|
| 38 |
\DTLread[ |
| 39 |
name=growthdata2, format=tsv,csv-skip-lines=1, |
| 40 |
keys={Exp1Time,Exp1Count,Exp2Time,Exp2Count,Exp3Time,Exp3Count}, |
| 41 |
csv-content=no-parse, |
| 42 |
data-types=decimal |
| 43 |
]{growth2}% growth2.tsv |
| 44 |
|
| 45 |
|
| 46 |
\RenewDocumentCommand \DTLplotlegendxy { O{0} m O{0} m O{0} m } |
| 47 |
{% |
| 48 |
\DTLplotlegendy[#1]{#2}[#5]{#6}% |
| 49 |
} |
| 50 |
\DTLplotlegendsetname{growthdata}{$T=6$} |
| 51 |
\DTLplotlegendsetname{growthdata2}{$T=8$} |
| 52 |
\RenewDocumentCommand \DTLplotlegendy { O{0} m O{0} m }{Experiment #3} |
| 53 |
\begin{document} |
| 54 |
\DTLplot{growthdata,growthdata2}{ |
| 55 |
x={Exp1Time,Exp2Time,Exp3Time}, |
| 56 |
y={Exp1Count,Exp2Count,Exp3Count}, |
| 57 |
x-label={Time ($t$)},y-label={Log Count}, |
| 58 |
legend, |
| 59 |
width=2.5in,height=2.5in |
| 60 |
} |
| 61 |
\end{document} |