% This file is embedded in datatool-user.pdf version 3.4 2025-04-03
% Example 155 Scatter Plot With Mismatched X and Y Columns
% Label: "ex:growthscatter6col2db2x3y"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{scontents}% to write test file with TABs preserved
\begin{scontents}[write-out={growth.tsv},overwrite]
Experiment 1		Experiment 2	
Time	Log Count	Time	Log Count
0	2.9	0	3.31
15	3.14	10	3.45
30	3.26	25	3.61
45	4.01	40	3.76
60	4.2	55	3.89
\end{scontents}

\begin{scontents}[write-out={growth2.tsv},overwrite]
Experiment 1		Experiment 2		Experiment 3	
Time	Log Count	Time	Log Count	Time	Log Count
0	3.21	0	3.39	0	3.28
15	3.43	10	3.51	10	3.45
30	3.68	25	3.65	20	3.57
45	4.4	40	3.84	30	3.64
60	4.8	55	3.92	40	3.95
\end{scontents}

\usepackage{dataplot}
\DTLsetup{store-datum}
\DTLread[
 name=growthdata, format=tsv,csv-skip-lines=1,
 keys={Exp1Time,Exp1Count,Exp2Time,Exp2Count},
 csv-content=no-parse,
 data-types=decimal
]{growth}% growth.tsv

\DTLread[
 name=growthdata2, format=tsv,csv-skip-lines=1,
 keys={Exp1Time,Exp1Count,Exp2Time,Exp2Count,Exp3Time,Exp3Count},
 csv-content=no-parse,
 data-types=decimal
]{growth2}% growth2.tsv
 
\begin{document}
% useful for debugging, this will show the column keys instead of the headers in the legend:
\RenewDocumentCommand \DTLplotlegendx { O{0} m O{0} m }{#4}
\RenewDocumentCommand \DTLplotlegendy { O{0} m O{0} m }{#4}


% now draw the plot:
 \DTLplot{growthdata,growthdata2}{
 x={Exp1Time,Exp2Time},
 y={Exp1Count,Exp2Count,Exp3Count},
 x-label={Time ($t$)},y-label={Log Count},
 legend,
 width=2.5in,height=2.5in
} 
\end{document}