3

I am having issues when using colormaps within group plots that have date coordinates in x.

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{dateplot}
\pgfplotsset{
    compat = 1.16,
    width = 8cm,
    height = 5cm,
}
\begin{document}
%
% Group plot with date coordinates in x
% Colormap does not work
%
\begin{tikzpicture}
\begin{groupplot}[
    colorbar, % This fails
    group style = {
        group size = 1 by 2,
    },
    date coordinates in = x,
]
\nextgroupplot
\addplot [mesh] coordinates {
    (2018-01-01, 1)
    (2018-02-01, 2)
    (2018-03-01, 3)
    (2018-04-01, 4)
    (2018-05-01, 5)
    (2018-06-01, 6)
};
\nextgroupplot
\addplot [mesh] coordinates {
    (2018-01-01, 1)
    (2018-02-01, 4)
    (2018-03-01, 9)
    (2018-04-01, 16)
    (2018-05-01, 25)
    (2018-06-01, 36)
};
\end{groupplot}
\end{tikzpicture}
%
% Group plot with numerical coordinates in x (no dates)
% Colormap works
%
\begin{tikzpicture}
\begin{groupplot}[
    colorbar,
    group style = {
        group size = 1 by 2,
    },
]
\nextgroupplot
\addplot [mesh] coordinates {
    (1, 1)
    (2, 2)
    (3, 3)
    (4, 4)
    (5, 5)
    (6, 6)
};
\nextgroupplot
\addplot [mesh] coordinates {
    (1, 1)
    (2, 4)
    (3, 9)
    (4, 16)
    (5, 25)
    (6, 36)
};
\end{groupplot}
\end{tikzpicture}
%
% Individual plots with date coordinates in x
% Colormap works
%
\begin{tikzpicture}
\begin{axis}[
    colorbar,
    date coordinates in = x,
]
\addplot [mesh] coordinates {
    (2018-01-01, 1)
    (2018-02-01, 2)
    (2018-03-01, 3)
    (2018-04-01, 4)
    (2018-05-01, 5)
    (2018-06-01, 6)
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
    colorbar,
    date coordinates in = x,
]
\addplot [mesh] coordinates {
    (2018-01-01, 1)
    (2018-02-01, 4)
    (2018-03-01, 9)
    (2018-04-01, 16)
    (2018-05-01, 25)
    (2018-06-01, 36)
};
\end{axis}
\end{tikzpicture}
\end{document}

If I make two individual plots (with \begin{axis}...\end{axis}) then the colormaps work as expected. If I make a group plot using numerical coordinates (i.e., no dates) then the colormaps work as expected. If I try to have both, I get the following error:

Runaway argument?
\pgfplots@calender@ZEROSHIFT \relax \ifx \pgfplotstemptime \pgfutil@empty \ETC.
! File ended while scanning use of \pgfcalendar@datetojulian.
<inserted text> 
                \par 
<*> a.tex

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

! Emergency stop.

What am I doing wrong?

2
  • 1
    It is of course possible that you're doing nothing at all wrong, but that there is something wrong with the package and libraries. – Torbjørn T. May 30 '19 at 19:29
  • I guess you have found a bug. I have documented it in the PGFPlots tracker as bug #223. – Stefan Pinnow May 30 '19 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.