Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have input data that looks like this:

Age Count   Cumulative Count    Percent Cumulative Percent                  
24  1   1   1.4084507   1.4084507
25  1   2   1.4084507   2.81690141
30  2   4   2.81690141  5.63380282
31  1   5   1.4084507   7.04225352
32  1   6   1.4084507   8.45070423

The standard bar plot is too dense:

\documentclass{scrartcl}

\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.10}

\pgfplotstableread[col sep=tab]{../tables/dob-roditelja.dat}{\tableparentage}
\pgfplotsset{%
    graph/.style={ymajorgrids,yminorgrids,xtick=data,ybar}%
}

\begin{document}

\begin{figure}[h!tb]
\centering
\begin{tikzpicture}
\begin{axis}[
    graph,
    ylabel={$n$},
    ylabel style={rotate=-90},
    bar width=5pt
]
\addplot table[x=Age,y=Count]{\tableparentage};
\legend{Age}
\end{axis}
\end{tikzpicture}
\end{figure}

\end{document}

enter image description here

I therefore considered having a histogram instead with age groups 20-25, 26-30 and so on. Reading from the manual, it seems that the input data is repeated if there are multiple values to be plotted in a histogram.

How can I have input values with counts already in the table?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.