9

Here's a possible workaround; I used a leading zero for the alignment of the day. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \pagestyle{empty} \usepgfplotslibrary{dateplot} \makeatletter \newcommand{\nonmiltime}{% \ifnum\hour>12 \expandafter\two@digits\expandafter{\the\numexpr\hour-12\relax}% \else \...


9

You can use dates in xtick to specify where you want xticks, e.g. xtick = { {1994-01-01}, {1997-01-01}, {2000-01-01}, {2003-01-01}, {2006-01-01}, {2000-01-01}, {2012-01-01} } Add this to the axis options.


9

You almost had it: The extra tick labels can accept all the same options as the normal tick labels, you just need to provide them via extra x tick style={<normal tick options>}. In this case, you would say extra x tick style={xticklabel=\year}. If you want to fancy things up a little bit, you can draw the group lines automatically, using a bit of ...


8

As was already suggested by John Kormylo in the comments below the question, the key is to convert the dates to integers in a new column of the data table. For more details, please have a look at the comments in the code. % used PGFPlots(Table) v1.14 % (borrowed code from <https://tex.stackexchange.com/a/302298/95441>) \begin{filecontents*}{testtable....


8

Well at first \thisrow{Time} has not the correct format for your \myparse command. You seem to expect that it gets magically expanded before it is inserted in the definition body of \TimeParse command. At second it is probably a good idea to create an expandable command. That means no \edef and no assignments in the definition. This here seems to work: \...


7

Quick solution: % make sure dateplot lib is loaded first \usepgfplotslibrary{dateplot} % redefine pgfcalendar internals \makeatletter % defined in file pgfcalendar.code.tex \def\pgfcalendarmonthshortname#1{% \pgfutil@translate{\ifcase#1\or Jan\or Feb\or Mar\or Apr\or % here I have changed "May" to "Mei" as an example Mei\or Jun\or Jul\or Aug\or ...


6

In general, you can always customize your tick labels manually, without resorting to date coordinates in or symbolic coords. For the records here, I will show how (see my second example in this answer) even though I have something which might fit better (my first example). But since you asked for some "more efficient one-liner", I found one for you by ...


6

As already seen in Ben's answer it seems that you have to convert the dates to some numeric value to make it work. I present a solution where I extend your data table by converting the dates with the \pgfcalendardatetojulian command from the pgfcalendar library/package and then use this new column for the histogram. For more details have a look at the ...


5

You solution is the correct practise: to provide xtick with a suitable list. However, a "suitable list" may include increments! Try this, for example: \documentclass{article} \usepackage{tikz} \begin{document} \foreach \value in {2012-01-01,2012-...-01,2012-12-01} {\value\par} \end{document} You can combine multiple years into one list, but in that case,...


5

This is not automatic, but other than that I think it solves your problem. You basically make two plots next to each other, and remove part of the axis frame. I also drew a zig-zag line like in the question you mentioned. \documentclass[border=4mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \usepgfplotslibrary{dateplot,groupplots} \...


5

If you want to set the minimum and maximum values for the x-axis, you can use xmin and xmax, like so: \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \pgfplotsset{compat=1.8} \begin{document} \begin{tikzpicture} \begin{axis}[date coordinates in=x,date ZERO=2013-08-18, xticklabel=\month-\day,ymin=0,ymax=...


5

You can enter the coordinate system (cs) of an axis using axis cs. You should use this, whenever you want to add something to a plot, because pgfplots takes care of appropriate data scaling, logarithms, and even symbolic x coords. Have a look at the following, this might give you a good starting point. \documentclass{standalone} \usepackage{...


5

June only has 30 days :) ... \addplot [smooth,line width=2,red] coordinates { (2013-1-31,13811) (2013-2-28,10396) (2013-3-31,11563) (2013-4-30,10512) (2013-5-28,6290) (2013-6-30,5453) (2013-7-31,5920) (2013-8-31,7264) (2013-9-30,7215) (2013-10-31,10481) (2013-11-30,14485) (2013-12-31,14375) }; ... I also corrected the days of the month for September.


5

The dateplot library shipped with pgfplots cannot handle seconds due to limited accuracy. If you need accuracy of this granularity, you can probably ignore the DATE part of your input. In this case, a solution could be as follows: \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \def\checkSameDate#1{% \ifnum\coordindex=0 ...


5

With the pgfplots library fillbetween: Code: \begin{filecontents}{Werte.txt} date sys dia gew 17-11-14 167 100 98 17-11-15 170 99 98 17-11-16 160 95 97 17-11-17 162 95 97 17-11-18 160 93 96 \end{filecontents} \documentclass{scrartcl} \usepackage[ngerman]{babel} \usepackage{geometry} \geometry{margin=20mm,bottom=25mm} \usepackage[...


4

Instead of restructuring your input data, you can also do this automatically via PGFPlots restrict y to domain* feature. Your example would then be plotted by the following source code: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotstableread{ Year OneCol SecCol ThirdCol ForthCol 2005 10 50 -10 30 2006 -40 ...


4

You can use the error bar functionality for this. Since the plots are on different axes, you'll need to make sure that you know the scaling factor by explicitly setting ymin and ymax. I've rescaled your upload axis to include 0. I feel that this axis range represents the data more accurately. In your original scale, it looked like the upload rate was almost ...


4

Using dashes instead of slashes compile without errors. \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \begin{document} \begin{tikzpicture} \begin{axis}[ xticklabel=\hour:\minute:\second, date coordinates in=x, xticklabel style= {rotate=45,anchor=north east}, xtick={ {07-01-2013 04:00:00}, {07-01-2013 05:00:00} }, xmin={...


4

First of all, about packages/libraries you loaded: both \usetikzlibrary{pgfplots.dateplot} and \usepgfplotslibrary{dateplot} loads tikzlibrarypgfplots.dateplot.code.tex, which then loads pgfcalendar.code.tex, which \usepackage{pgfcalendar} loads. And you need pgfplots, which pgfplotstable loads. Anyway, dateplot expects "complete" time stamp. It likes 2016-...


4

xtick=data works for dateplots as well, so simply adding that to your axis options will give a tick at each data point. To have the data points equidistant, you can not use the dateplot stuff, but instead set x expr=\coordindex, and then use xtick=data, xticklabels from table to get whatever ticklabels you'd like. Here I used the date column, which you ...


4

You're using a space as the column separator, and you have a space between yyyy-mm-dd and HH:MM:SS. So yyyy-mm-dd is read as the x-column, and HH:MM:SS as the y-column. Use something like x,y 2018-05-18 00:00:19, -59 2018-05-18 00:01:01, -59 and \addplot [...] table[col sep=comma] {... Note by the way that the precision of the dateplot library is limited,...


4

Looks like you can use the macros provided by the pgfcalendar package to convert \year-\month-\day to Julian days (\pgfcalendardatetojulian), then to day of week (\pgfcalendarjuliantoweekday) and then print the corresponding weekday (\pgfcalendarweekdayshortname), all directly in xticklabel: xticklabel = \pgfcalendardatetojulian{\year-\month-\day}{\...


4

Remove xtick=data from your code, and add in some minor ticks if you want ticks on each day. Thanks to Schrödinger's cat for the abbreviated month names. \documentclass[12pt]{article} \usepackage{pgfplots} \pgfplotsset{width=6in,compat=newest} \usepgfplotslibrary{dateplot} \begin{document} \begin{flushleft} \begin{tikzpicture} \...


3

I ended up faking it. \begin{tikzpicture} \begin{axis}[ width=\linewidth, height=0.6\linewidth, axis lines=left, ymin=0, ylabel={Price (NOK)}, ylabel near ticks, minor xtick=\empty, xtick={52, 104, ..., 260}, xticklabel=\empty, xmajorgrids=true, ] \addplot [...


3

I wrote a little Python program to convert the yyyy-mm-dd dates into floating point numbers, which should approximately match the according positions on the time axis. import re f = open('floatdates.dat','w') pattern = r'(\d+)-(\d+)-(\d+)\t([\d.]+)' for line in open('data.dat'): data = re.findall(pattern,line) if len(data)>0: ...


Only top voted, non community-wiki answers of a minimum length are eligible