Debian Codegraph @

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

raw
1 % This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
2 % Example 182 Redefining the Start and End Hooks
3 % Label: "ex:plotxyhooks"
4 % arara: pdflatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 \begin{filecontents}[noheader,overwrite]{xydata.csv}
9 X,Y
10 -3.5,-2.75
11 -3,3
12 -2.5,-1
13 -1,1.5
14 1,-4.2
15 2.6,1.8
16 3.2,-0.4
17 \end{filecontents}
18
19 \usepackage{dataplot}
20 \DTLsetup{store-datum}
21 \DTLread[
22 name=xydata,
23 format=csv,
24 csv-content=no-parse
25 , data-types=decimal
26 ]{xydata.csv}
27
28 \renewcommand{\DTLplotdisplayticklabel}[1]{\ensuremath{#1}}
29 \renewcommand{\DTLplotatbegintikz}{\draw (0,0) node[anchor=north east] {0};}
30 \renewcommand{\DTLplotatendtikz}{
31 \draw[blue,dotted] (\DTLminX,\DTLminY) -- (\DTLmaxX, \DTLminY)
32 node[right] {$y_{\min} = \DTLminY$};
33 \draw[blue,dotted] (\DTLminX,\DTLmaxY) -- (\DTLmaxX, \DTLmaxY)
34 node[right] {$y_{\max} = \DTLmaxY$};
35 }
36 \begin{document}
37 \DTLplot{xydata}{
38 x=X, y={Y},
39 tick-dir=out, tick-gap=1, round=0,
40 extend-axes={0,0.5},
41 tick-label-style={font=\small},
42 tick-label-offset=0pt,
43 axis-style={->,thick},
44 max-x-label={$x$}, max-y-label={$y$},
45 style=lines, width=3in, height=3in
46 }
47 \end{document}