Debian Codegraph @

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

raw
1 % This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
2 % Example 140 Bar Chart With Rotated Tick Labels
3 % Label: "ex:barchartrotateyticlabels"
4 % arara: pdflatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 % sample CSV file:
9 \begin{filecontents}[noheader,overwrite]{profits.csv}
10 Year,Profit,Units
11 1999,"-\$4,673",12467
12 2000,"\$2,525.49",8965
13 2001,"\$1,673.52",14750
14 2002,"-\$1,320.01",14572
15 2003,"\$5,694.83",13312
16 2004,"\$-451.67",9764
17 2005,"\$6,785.20",11235
18 \end{filecontents}
19
20
21 \usepackage{databar}
22 % Load data from profits.csv file:
23 \DTLsetup{store-datum,default-name=profits}
24 \DTLread[csv-content=tex]{profits.csv}
25 \begin{document}
26 \renewcommand{\DTLbardisplayYticklabel}[1]{\rotatebox{45}{#1}}
27 \DTLbarchart
28 {
29 variable=\theProfit,
30 horizontal,
31 color-style=single,
32 max-depth=-5000,
33 max=10000,
34 bar-width=20pt,bar-gap=0.5,
35 axes,y-ticks,y-tick-gap=1000,
36 ylabel={Loss / Profits},
37 ylabel-position=zero,
38 bar-label={\theYear},
39 upper-bar-label={\DTLbarvalue},
40 round=2,
41 y-tick-round=0,
42 ytic-label-align={right,top}
43 }
44 {profits}% database
45 {% assignment list
46 \theYear=Year,
47 \theProfit=Profit
48 }
49 \end{document}