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 a data set that has values for a set of dates, but these dates don't have a regular interval (i.e. 1 Feb., 3 Feb., 15 Feb., 5 March) . So my question is: is there a package or other method to plot this easily?

share|improve this question
1  
pst-plot provides such a requirement. –  Oh my ghost Dec 31 '12 at 9:37

1 Answer 1

up vote 9 down vote accepted

A possible approach is the pgfplots package with the dateplot library.

Here is an example with fictitious data and the dates you provided in the question:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7} % with TeXLive updated this is the current version; use the one you have installed
\usepgfplotslibrary{dateplot}
\usepackage{filecontents}% to generate fictitious data
\begin{filecontents}{data.dat}
date incoming
2012-02-01 1500
2012-02-03 1275
2012-02-15 1480
2012-03-03 1600
\end{filecontents}

\begin{document}    
\begin{tikzpicture}
\begin{axis}[
  date coordinates in=x,
  xtick={data},
  xticklabel={\day.\month},
  xticklabel style={rotate=-45,font=\footnotesize},
  xlabel={2012},
  stack plots=y,
  yticklabel={\pgfmathprintnumber{\tick}\$},
  ylabel=Total incoming,
  ylabel style={yshift=10pt},
]
\addplot table[x=date,y=incoming] {data.dat};
\end{axis}
\end{tikzpicture}    
\end{document}

The result:

enter image description here

For further details refer to section 4.20.2 Dates as Input Coordinates of the pgfplots manual.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.