About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2021-06-05: New blog post: Dickimaw Books Site Account.

A Bar Chart (databar.sty)

This example requires the booklists.csv data.
\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[x11names]{xcolor}
\usepackage{databar}

\DTLloaddb{books}{booklist.csv}

\DTLsetbarcolor{1}{Aquamarine1}
\DTLsetbarcolor{2}{Azure2}
\DTLsetbarcolor{3}{Burlywood3}
\DTLsetbarcolor{4}{CadetBlue2}
\DTLsetbarcolor{5}{Chartreuse3}
\DTLsetbarcolor{6}{Salmon1}
\DTLsetbarcolor{7}{DeepPink1}
\DTLsetbarcolor{8}{Goldenrod1}
\DTLsetbarcolor{9}{Honeydew1}
\DTLsetbarcolor{10}{Plum3}

\setlength{\DTLbaroutlinewidth}{1pt}
\setlength{\DTLbarwidth}{1.2cm}

\begin{document}

\setcounter{DTLbarroundvar}{2}

\DTLbarchart
 {variable=\ThePrice,% data base column
  axes=both,% show both axes
  barlabel={\parbox{4cm}{\raggedright\TheTitle}},% bar labels
  upperbarlabel={\pounds\ThePrice},% upper bar labels
  yticgap=10,% gap between y tick marks
  ylabel={Price (\pounds)}% y-axis label
 }% settings
 {books}% data base
 {\ThePrice=price,\TheTitle=title}% assignment list

\end{document}

Download databar-sample.tex or databar-sample.pdf.

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs