pgf-tikz / pgfplots

pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.
http://pgfplots.sourceforge.net/
198 stars 33 forks source link

`boxplot/draw position` from `statistics` not compatible with `dateplot` #450

Open bf opened 1 year ago

bf commented 1 year ago

This has been driving me crazy over the last few days. I'm trying to use a boxplot prepared within a groupplot with date coordintaes in=x. Maybe someone can help with this.

I'm getting two main error messages:

Minimum viable error tex file is below. Run with: latexmk -f -lualatex -interaction=nonstopmode -halt-on-error minimal-boxplot-error.tex

\documentclass[12pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{dateplot}
\usepgfplotslibrary{statistics}
\usepackage{pgfcalendar}

\begin{document}
\begin{tikzpicture}
    \begin{groupplot}[
        group style={group size=1 by 1}, 
        date coordinates in=x,
        xmin=2013-01-01,
        xmax=2013-12-01
    ]
        \nextgroupplot[boxplot draw direction=y]
        \addplot+[boxplot prepared={lower whisker=1, upper whisker=5, lower quartile=2, upper quartile=4, median=3, draw position=2013-06-01}] coordinates {};
    \end{groupplot}
\end{tikzpicture}
\end{document}
Runaway argument?
\pgfplots@calender@ZEROSHIFT \relax \ifx \pgfplotstemptime \pgfutil@empty \ETC.
! File ended while scanning use of \pgfcalendar@datetojulian.
<inserted text> 
\par 
<*> minimal-boxplot-error.tex
Full log ``` This is LuaHBTeX, Version 1.15.0 (TeX Live 2022/Arch Linux) (format=lualatex 2022.12.5) 7 DEC 2022 14:18 restricted system commands enabled. **minimal-boxplot-error.tex (./minimal-boxplot-error.tex LaTeX2e <2021-11-15> patch level 1 Lua module: luaotfload 2022-03-18 3.21 Lua based OpenType font support Lua module: lualibs 2021-05-20 2.74 ConTeXt Lua standard libraries. Lua module: lualibs-extended 2021-05-20 2.74 ConTeXt Lua libraries -- extended c ollection. luaotfload | conf : Root cache directory is "/home/beni/.texlive/texmf-var/luate x-cache/generic/names". luaotfload | init : Loading fontloader "fontloader-2022-02-24.lua" from kpse-res olved path "/usr/share/texmf-dist/tex/luatex/luaotfload/fontloader-2022-02-24.lu a". Lua-only attribute luaotfload@noligature = 1 luaotfload | init : Context OpenType loader version 3.119 Inserting `luaotfload.node_processor' at position 1 in `pre_linebreak_filter'. Inserting `luaotfload.node_processor' at position 1 in `hpack_filter'. Inserting `luaotfload.glyph_stream' at position 1 in `glyph_stream_provider'. Inserting `luaotfload.define_font' at position 1 in `define_font'. Lua-only attribute luaotfload_color_attribute = 2 luaotfload | conf : Root cache directory is "/home/beni/.texlive/texmf-var/luate x-cache/generic/names". Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_opentype_file'. Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_truetype_file'. Removing `luaotfload.glyph_stream' from `glyph_stream_provider'. Inserting `luaotfload.harf.glyphstream' at position 1 in `glyph_stream_provider' . Inserting `luaotfload.harf.finalize_vlist' at position 1 in `post_linebreak_filt er'. Inserting `luaotfload.harf.finalize_hlist' at position 2 in `hpack_filter'. Inserting `luaotfload.cleanup_files' at position 1 in `wrapup_run'. Inserting `luaotfload.harf.finalize_unicode' at position 1 in `finish_pdffile'. Inserting `luaotfload.glyphinfo' at position 1 in `glyph_info'. Lua-only attribute luaotfload.letterspace_done = 3 Inserting `luaotfload.aux.set_sscale_dimens' at position 1 in `luaotfload.patch_ font'. Inserting `luaotfload.aux.set_font_index' at position 2 in `luaotfload.patch_fon t'. Inserting `luaotfload.aux.patch_cambria_domh' at position 3 in `luaotfload.patch _font'. Inserting `luaotfload.aux.fixup_fontdata' at position 1 in `luaotfload.patch_fon t_unsafe'. Inserting `luaotfload.aux.set_capheight' at position 4 in `luaotfload.patch_font '. Inserting `luaotfload.aux.set_xheight' at position 5 in `luaotfload.patch_font'. Inserting `luaotfload.rewrite_fontname' at position 6 in `luaotfload.patch_font' . L3 programming layer <2022-04-10> Inserting `tracingstacklevels' at position 1 in `input_level_string'. (/usr/share/texmf-dist/tex/latex/base/article.cls Document Class: article 2021/10/04 v1.4n Standard LaTeX document class (/usr/share/texmf-dist/tex/latex/base/size12.clo File: size12.clo 2021/10/04 v1.4n Standard LaTeX file (size option) luaotfload | db : Font names database loaded from /home/beni/.texlive/texmf-var/ luatex-cache/generic/names/luaotfload-names.luc.gz) \c@part=\count183 \c@section=\count184 \c@subsection=\count185 \c@subsubsection=\count186 \c@paragraph=\count187 \c@subparagraph=\count188 \c@figure=\count189 \c@table=\count190 \abovecaptionskip=\skip47 \belowcaptionskip=\skip48 \bibindent=\dimen137 ) (/usr/share/texmf-dist/tex/latex/pgfplots/pgfplots.sty (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex) Package: pgfplots 2021/05/15 v1.18.1 Data Visualization (1.18.1) (/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR) (/usr/share/texmf-dist/tex/latex/graphics/keyval.sty Package: keyval 2014/10/28 v1.15 key=value parser (DPC) \KV@toks@=\toks16 ) (/usr/share/texmf-dist/tex/latex/graphics/graphics.sty Package: graphics 2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR) (/usr/share/texmf-dist/tex/latex/graphics/trig.sty Package: trig 2021/08/11 v1.11 sin cos tan (DPC) ) (/usr/share/texmf-dist/tex/latex/graphics-cfg/graphics.cfg File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration ) Package graphics Info: Driver file: luatex.def on input line 107. (/usr/share/texmf-dist/tex/latex/graphics-def/luatex.def File: luatex.def 2021/06/01 v1.2c Graphics/color driver for luatex )) \Gin@req@height=\dimen138 \Gin@req@width=\dimen139 ) (/usr/share/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty (/usr/share/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty (/usr/share/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex \pgfutil@everybye=\toks17 \pgfutil@tempdima=\dimen140 \pgfutil@tempdimb=\dimen141 (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex)) (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def \pgfutil@abb=\box50 ) (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex (/usr/share/texmf-dist/tex/generic/pgf/pgf.revision.tex) Package: pgfrcs 2021/05/15 v3.1.9a (3.1.9a) )) Package: pgf 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty (/usr/share/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty (/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex Package: pgfsys 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex \pgfkeys@pathtoks=\toks18 \pgfkeys@temptoks=\toks19 (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex \pgfkeys@tmptoks=\toks20 )) \pgf@x=\dimen142 \pgf@y=\dimen143 \pgf@xa=\dimen144 \pgf@ya=\dimen145 \pgf@xb=\dimen146 \pgf@yb=\dimen147 \pgf@xc=\dimen148 \pgf@yc=\dimen149 \pgf@xd=\dimen150 \pgf@yd=\dimen151 \w@pgf@writea=\write3 \r@pgf@reada=\read2 \c@pgf@counta=\count191 \c@pgf@countb=\count192 \c@pgf@countc=\count193 \c@pgf@countd=\count194 \t@pgf@toka=\toks21 \t@pgf@tokb=\toks22 \t@pgf@tokc=\toks23 \pgf@sys@id@count=\count195 (/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg File: pgf.cfg 2021/05/15 v3.1.9a (3.1.9a) ) Driver file for pgf: pgfsys-luatex.def (/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-luatex.def File: pgfsys-luatex.def 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def File: pgfsys-common-pdf.def 2021/05/15 v3.1.9a (3.1.9a) ))) (/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex File: pgfsyssoftpath.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgfsyssoftpath@smallbuffer@items=\count196 \pgfsyssoftpath@bigbuffer@items=\count197 ) (/usr/share/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex File: pgfsysprotocol.code.tex 2021/05/15 v3.1.9a (3.1.9a) )) (/usr/share/texmf-dist/tex/latex/xcolor/xcolor.sty Package: xcolor 2021/10/31 v2.13 LaTeX color extensions (UK) (/usr/share/texmf-dist/tex/latex/graphics-cfg/color.cfg File: color.cfg 2016/01/02 v1.6 sample color configuration ) Package xcolor Info: Driver file: luatex.def on input line 227. Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1352. Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1356. Package xcolor Info: Model `RGB' extended on input line 1368. Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1370. Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1371. Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1372. Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1373. Package xcolor Info: Model `Gray' substituted by `gray' on input line 1374. Package xcolor Info: Model `wave' substituted by `hsb' on input line 1375. ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex Package: pgfcore 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex \pgfmath@dimen=\dimen152 \pgfmath@count=\count198 \pgfmath@box=\box51 \pgfmath@toks=\toks24 \pgfmath@stack@operand=\toks25 \pgfmath@stack@operation=\toks26 ) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code .tex) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.te x) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics .code.tex))) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex \c@pgfmathroundto@lastzeros=\count199 )) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfint.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex File: pgfcorepoints.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgf@picminx=\dimen153 \pgf@picmaxx=\dimen154 \pgf@picminy=\dimen155 \pgf@picmaxy=\dimen156 \pgf@pathminx=\dimen157 \pgf@pathmaxx=\dimen158 \pgf@pathminy=\dimen159 \pgf@pathmaxy=\dimen160 \pgf@xx=\dimen161 \pgf@xy=\dimen162 \pgf@yx=\dimen163 \pgf@yy=\dimen164 \pgf@zx=\dimen165 \pgf@zy=\dimen166 ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex File: pgfcorepathconstruct.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgf@path@lastx=\dimen167 \pgf@path@lasty=\dimen168 ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex File: pgfcorepathusage.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgf@shorten@end@additional=\dimen169 \pgf@shorten@start@additional=\dimen170 ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex File: pgfcorescopes.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgfpic=\box52 \pgf@hbox=\box53 \pgf@layerbox@main=\box54 \pgf@picture@serial@count=\count266 ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex File: pgfcoregraphicstate.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgflinewidth=\dimen171 ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.t ex File: pgfcoretransformations.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgf@pt@x=\dimen172 \pgf@pt@y=\dimen173 \pgf@pt@temp=\dimen174 ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex File: pgfcorequick.code.tex 2021/05/15 v3.1.9a (3.1.9a) ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex File: pgfcoreobjects.code.tex 2021/05/15 v3.1.9a (3.1.9a) ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.te x File: pgfcorepathprocessing.code.tex 2021/05/15 v3.1.9a (3.1.9a) ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex File: pgfcorearrows.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgfarrowsep=\dimen175 ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex File: pgfcoreshade.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgf@max=\dimen176 \pgf@sys@shading@range@num=\count267 \pgf@shadingcount=\count268 ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex File: pgfcoreimage.code.tex 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex File: pgfcoreexternal.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgfexternal@startupbox=\box55 )) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex File: pgfcorelayers.code.tex 2021/05/15 v3.1.9a (3.1.9a) ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex File: pgfcoretransparency.code.tex 2021/05/15 v3.1.9a (3.1.9a) ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex File: pgfcorepatterns.code.tex 2021/05/15 v3.1.9a (3.1.9a) ) (/usr/share/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.tex File: pgfcorerdf.code.tex 2021/05/15 v3.1.9a (3.1.9a) ))) (/usr/share/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex File: pgfmoduleshapes.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgfnodeparttextbox=\box56 ) (/usr/share/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex File: pgfmoduleplot.code.tex 2021/05/15 v3.1.9a (3.1.9a) ) (/usr/share/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty Package: pgfcomp-version-0-65 2021/05/15 v3.1.9a (3.1.9a) \pgf@nodesepstart=\dimen177 \pgf@nodesepend=\dimen178 ) (/usr/share/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty Package: pgfcomp-version-1-18 2021/05/15 v3.1.9a (3.1.9a) )) (/usr/share/texmf-dist/tex/latex/pgf/utilities/pgffor.sty (/usr/share/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)) (/usr/share/texmf-dist/tex/latex/pgf/math/pgfmath.sty (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)) (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex Package: pgffor 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex) \pgffor@iter=\dimen179 \pgffor@skip=\dimen180 \pgffor@stack=\toks27 \pgffor@toks=\toks28 )) (/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex Package: tikz 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.te x File: pgflibraryplothandlers.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgf@plot@mark@count=\count269 \pgfplotmarksize=\dimen181 ) \tikz@lastx=\dimen182 \tikz@lasty=\dimen183 \tikz@lastxsaved=\dimen184 \tikz@lastysaved=\dimen185 \tikz@lastmovetox=\dimen186 \tikz@lastmovetoy=\dimen187 \tikzleveldistance=\dimen188 \tikzsiblingdistance=\dimen189 \tikz@figbox=\box57 \tikz@figbox@bg=\box58 \tikz@tempbox=\box59 \tikz@tempbox@bg=\box60 \tikztreelevel=\count270 \tikznumberofchildren=\count271 \tikznumberofcurrentchild=\count272 \tikz@fig@count=\count273 (/usr/share/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex File: pgfmodulematrix.code.tex 2021/05/15 v3.1.9a (3.1.9a) \pgfmatrixcurrentrow=\count274 \pgfmatrixcurrentcolumn=\count275 \pgf@matrix@numberofcolumns=\count276 ) \tikz@expandcount=\count277 (/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary topaths.code.tex File: tikzlibrarytopaths.code.tex 2021/05/15 v3.1.9a (3.1.9a) ))) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex Package pgfplots info on input line 124: Initializing with LUA version Lua 5.3 \pgfplots@luabackend@table=\catcodetable12 \t@pgfplots@toka=\toks29 \t@pgfplots@tokb=\toks30 \t@pgfplots@tokc=\toks31 \pgfplots@tmpa=\dimen190 \c@pgfplots@coordindex=\count278 \c@pgfplots@scanlineindex=\count279 (/usr/share/texmf-dist/tex/generic/pgfplots/sys/pgfplotssysgeneric.code.tex)) (/usr/share/texmf-dist/tex/generic/pgfplots/libs/pgfplotslibrary.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_l oader.code.tex (/usr/share/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code .tex) Package pgfplots info on input line 290: luamath library shipped with pgf 3.1.9 a is up-to-date ) (/usr/share/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex Package pgfplots info on input line 82: Found new luatex: initializing lua comm ands instead of write18 (shell-escape) (/usr/share/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure .code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure ext.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.te x \c@pgfplotsarray@tmp=\count280 ) (/usr/share/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsmatrix.code.t ex) (/usr/share/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.t ex \c@pgfplotstable@counta=\count281 \t@pgfplotstable@a=\toks32 ) (/usr/share/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsdeque.code.te x) (/usr/share/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex (/usr/share/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.data.code.tex)) (/usr/share/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.verb.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading .code.tex \c@pgfplotslibrarysurf@no=\count282 (/usr/share/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading. pgfsys-luatex.def))) (/usr/share/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex (/usr/share/texmf-dist/tex/generic/pgfplots/util/pgfplotscolor.code.tex)) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplotimage.code.tex))) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplots.errorbars.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplots.markers.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex) (/usr/share/texmf-dist/tex/generic/pgfplots/pgfplots.paths.code.tex) (/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary decorations.code.tex (/usr/share/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex \pgfdecoratedcompleteddistance=\dimen191 \pgfdecoratedremainingdistance=\dimen192 \pgfdecoratedinputsegmentcompleteddistance=\dimen193 \pgfdecoratedinputsegmentremainingdistance=\dimen194 \pgf@decorate@distancetomove=\dimen195 \pgf@decorate@repeatstate=\count283 \pgfdecorationsegmentamplitude=\dimen196 \pgfdecorationsegmentlength=\dimen197 ) \tikz@lib@dec@box=\box61 ) (/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary decorations.pathmorphing.code.tex (/usr/share/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorati ons.pathmorphing.code.tex)) (/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary decorations.pathreplacing.code.tex (/usr/share/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorati ons.pathreplacing.code.tex)) (/usr/share/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.contourlua .code.tex) \pgfplots@numplots=\count284 \pgfplots@xmin@reg=\dimen198 \pgfplots@xmax@reg=\dimen199 \pgfplots@ymin@reg=\dimen256 \pgfplots@ymax@reg=\dimen257 \pgfplots@zmin@reg=\dimen258 \pgfplots@zmax@reg=\dimen259 ) (/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary plotmarks.code.tex File: tikzlibraryplotmarks.code.tex 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex File: pgflibraryplotmarks.code.tex 2021/05/15 v3.1.9a (3.1.9a) ))) (/usr/share/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots .code.tex \pgfplots@group@current@plot=\count285 \pgfplots@group@current@row=\count286 \pgfplots@group@current@column=\count287 (/usr/share/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary calc.code.tex File: tikzlibrarycalc.code.tex 2021/05/15 v3.1.9a (3.1.9a) )) (/usr/share/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.c ode.tex (/usr/share/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty (/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex File: pgfcalendar.code.tex 2021/05/15 v3.1.9a (3.1.9a) (/usr/share/texmf-dist/tex/generic/pgf/math/pgfint.code.tex) \pgfcalendarcurrentjulian=\count288 \pgf@cal@easter@Y=\count289 \pgf@cal@easter@G=\count290 \pgf@cal@easter@C=\count291 \pgf@cal@easter@X=\count292 \pgf@cal@easter@Z=\count293 \pgf@cal@easter@D=\count294 \pgf@cal@easter@E=\count295 \pgf@cal@easter@N=\count296 \pgf@cal@easter@M=\count297 \pgf@cal@easter@julianday=\count298 ))) (/usr/share/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.statistics .code.tex) (/usr/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def File: l3backend-luatex.def 2022-04-14 L3 backend support: PDF output (LuaTeX) \l__color_backend_stack_int=\count299 \l__pdf_internal_box=\box62 ) (./minimal-boxplot-error.aux) \openout1 = minimal-boxplot-error.aux LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 8. LaTeX Font Info: Trying to load font information for TS1+cmr on input line 8 . (/usr/share/texmf-dist/tex/latex/base/ts1cmr.fd File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions ) LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8. LaTeX Font Info: ... okay on input line 8. (/usr/share/texmf-dist/tex/context/base/mkii/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] \scratchcounter=\count300 \scratchdimen=\dimen260 \scratchbox=\box63 \nofMPsegments=\count301 \nofMParguments=\count302 \everyMPshowfont=\toks33 \MPscratchCnt=\count303 \MPscratchDim=\dimen261 \MPnumerator=\count304 \makeMPintoPDFobject=\count305 \everyMPtoPDFconversion=\toks34 ) (/usr/share/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 85. (/usr/share/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv e )) Package pgfplots notification 'compat/show suggested version=true': document ha s been generated with the most recent feature set (\pgfplotsset{compat=1.18}). Package pgfplots info on input line 15: Using 'lua backend=false' for axis: x c oord trafo unsupported. Package pgfplots info on input line 16: dateplot: setting 'date ZERO={}' for th is axis. ) Runaway argument? \pgfplots@calender@ZEROSHIFT \relax \ifx \pgfplotstemptime \pgfutil@empty \ETC. ! File ended while scanning use of \pgfcalendar@datetojulian. \par <*> minimal-boxplot-error.tex Here is how much of LuaTeX's memory you used: 23332 strings out of 477762 100000,1144653 words of node,token memory allocated 633 words of node memory still in use: 3 hlist, 2 rule, 5 dir, 8 glue, 3 kern, 1 glyph, 16 attribute, 63 glue_spec, 16 attribute_list, 4 temp, 3 if_stack, 1 write, 5 pdf_literal, 2 pdf_colorstack nodes avail lists: 2:17,3:1,9:1 43358 multiletter control sequences out of 65536+600000 15 fonts using 723367 bytes 99i,3n,98p,741b,1794s stack positions out of 5000i,500n,10000p,200000b,80000s ! ==> Fatal error occurred, no output PDF file produced! ```
bf commented 1 year ago

Issue seems to be related to FPU. The error occurs in /usr/share/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex.

I have added some logging to the problematic section:


\pgfplotsset{
    /pgfplots/date ZERO/.code={%
        \pgfplots@dateplot@parse@ZEROSHIFT{#1}%
        \let\pgfplots@calender@ZEROSHIFT=\pgfmathresult
    },
    /pgfplots/date coordinates in/.code={%
        \pgfkeysdef{/pgfplots/#1 coord trafo}{%
            \begingroup
            \edef\pgfplotstempjuliandate{##1}%
            % check if we also have a TIME like '2006-01-01 11:21'
            \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}%
            \ifpgfutil@in@
                % we have a TIME!
                \message{success: value ##1 is A TIME}
                \expandafter\pgfplotslibdateplot@map@time\pgfplotstempjuliandate:\dateto\pgfplotstempjuliandate\timeto\pgfplotstemptime
            \else
                \message{error: value ##1 is not TIME}
                \let\pgfplotstemptime=\pgfutil@empty
            \fi
            %
            \expandafter\pgfplots@dateplot@ensure@ZEROSHIFT\expandafter{\pgfplotstempjuliandate}%
            %
            \expandafter\pgfcalendardatetojulian\expandafter{\pgfplotstempjuliandate}\c@pgf@counta%
            {\advance \c@pgf@counta by -\pgfplots@calender@ZEROSHIFT\relax}%
            \message{value ##1 is \pgfplotstemptime}
            \ifx\pgfplotstemptime\pgfutil@empty%
                % no time:
                \message{no time}
                \edef\pgfmathresult{\the\c@pgf@counta}%
            \else
                % add time fraction (which should be in the range [0,1]).
                \message{no add time fraction (which should be in the range}
                \ifdim\pgfplotstemptime pt<1pt
                    % discard prefix '0.':
                    \expandafter\pgfplotslibdateplot@discard@zero@dot\pgfplotstemptime\to\pgfplotstemptime
                    \edef\pgfmathresult{\the\c@pgf@counta.\pgfplotstemptime}%
                \else
                    % assume \pgfplotstemptime=1pt :
                    \advance\c@pgf@counta by1
                    \edef\pgfmathresult{\the\c@pgf@counta}%
                \fi
            \fi
            \pgfmath@smuggleone\pgfmathresult
            \endgroup
        }%

It shows that the DATE value 2021-01-01 00:001 gets converted to 1Y1.0e0 which later creates runaway argument error in \edef\pgfmathresult{\the\c@pgf@counta.\pgfplotstemptime}%

success: value 2021-01-01 00:01 is A TIME value 2021-01-01 00:01 is 0.00069
no add time fraction (which should be in the range
success: value 2021-12-01 00:01 is A TIME value 2021-12-01 00:01 is 0.00069
no add time fraction (which should be in the range
error: value 1Y1.0e0] is not TIME
Runaway argument?
1Y1.0e0]+/{\c@pgf@counta }{\advance \c@pgf@counta by -\pgfplots@calender@ZEROSH
IFT \ETC.
! Paragraph ended before \pgfcalendar@datetojulian was complete.
<to be read again> 
\par 
l.114 

 653 words of node memory still in use:
   3 hlist, 2 rule, 5 dir, 10 glue, 3 kern, 1 glyph, 18 attribute, 63 glue_spec
, 18 attribute_list, 4 temp, 2 if_stack, 1 write, 5 pdf_literal, 2 pdf_colorsta
ck nodes
   avail lists: 2:16,3:1,9:1
!  ==> Fatal error occurred, no output PDF file produced!
bf commented 1 year ago

Underlying problem might be that dateplot works with FPU fixed and boxplot with FPU float data types.

Would be great if someone more experienced could tell me if this investigation is going on the right path..

bf commented 1 year ago

First error message can be circumvented if in tikzlibrarypgfplots.dateplot.code.tex at function /pgfplots/date coordinates in/.code= we add a check if it is actually a date or not at the very beginning, like this: \pgfcalendarifdate{\pgfplotstempjuliandate}{all}{ /* normal function */ }{ /* just return FPU float */ }

bf commented 1 year ago

I have monkeypatched tikzlibrarypgfplots.dateplot.code.tex and now it proceeds with the function.

However, sometimes the function is called with proper dates, e.g. "2020-01-01" and sometimes it is called with FPU floats such as 1Y2.0110002e3]. The problem is that it seems that dateplot internally uses gregorian days for counting, but the boxplot module from tikzlibrarypgfplots.statistics.code.tex tries to use these weird FPU floats. If the FPU float 1Y2.0110002e3 is decoded, it turns into stuff such as 2011.0002000000000 or 2010.6003000000000, which is "out of dimension" for the dateplot logic.

I need to find a way to turn these 2010.6003000000000 results into proper gregorian days that dateplot needs.

Here is my relevant log:

INPUT pgfplotstempjuliandate = 2020-03-06 raute: x vs. doppelraute 2020-03-06
++DATE++ YES: 2020-03-06is a DATE!
error: value 2020-03-06 does NOT have a time attached
pgfplotstempjuliandate = 2020-03-06 value 2020-03-06 is  no time
 (((returning 2458915)))  INPUT pgfplotstempjuliandate = 2020-03-06
raute: x vs. doppelraute 2020-03-06 ++DATE++ YES: 2020-03-06is a DATE!
error: value 2020-03-06 does NOT have a time attached
pgfplotstempjuliandate = 2020-03-06 value 2020-03-06 is  no time
 (((returning 2458915)))  INPUT pgfplotstempjuliandate = 1Y2.0110002e3]
raute: x vs. doppelraute 1Y2.0110002e3]  (((returning 2011.0002000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0110002e3]
raute: x vs. doppelraute 1Y2.0110002e3]  (((returning 2011.0002000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0110002e3]
raute: x vs. doppelraute 1Y2.0110002e3]  (((returning 2011.0002000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106802e3]
raute: x vs. doppelraute 1Y2.0106802e3]  (((returning 2010.6802000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0113202e3]
raute: x vs. doppelraute 1Y2.0113202e3]  (((returning 2011.3202000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106003e3]
raute: x vs. doppelraute 1Y2.0106003e3]  (((returning 2010.6003000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0114001e3]
raute: x vs. doppelraute 1Y2.0114001e3]  (((returning 2011.4001000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106003e3]
raute: x vs. doppelraute 1Y2.0106003e3]  (((returning 2010.6003000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0114001e3]
raute: x vs. doppelraute 1Y2.0114001e3]  (((returning 2011.4001000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106003e3]
raute: x vs. doppelraute 1Y2.0106003e3]  (((returning 2010.6003000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0114001e3]
raute: x vs. doppelraute 1Y2.0114001e3]  (((returning 2011.4001000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106003e3]
raute: x vs. doppelraute 1Y2.0106003e3]  (((returning 2010.6003000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0114001e3]
raute: x vs. doppelraute 1Y2.0114001e3]  (((returning 2011.4001000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0113202e3]
raute: x vs. doppelraute 1Y2.0113202e3]  (((returning 2011.3202000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106802e3]
raute: x vs. doppelraute 1Y2.0106802e3]  (((returning 2010.6802000000000))) 

Package pgfplots Warning: Axis range for axis x is approximately empty; enlargi
ng it (it is [2458915.000000000:2458915.000000000]) on input line 119.

 OOOOOOOOOOOOOO==OOOOO coord inv trafo:: 2200000.0000 x
 OOOOOOOOOOOOOO==OOOOO coord inv trafo:: 2400000.0000 x
 OOOOOOOOOOOOOO==OOOOO coord inv trafo:: 2600000.0000 x
 OOOOOOOOOOOOOO==OOOOO coord inv trafo:: 2800000.0000 x
INPUT pgfplotstempjuliandate = 1Y2.0110002e3]
raute: x vs. doppelraute 1Y2.0110002e3]  (((returning 2011.0002000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0110002e3]
raute: x vs. doppelraute 1Y2.0110002e3]  (((returning 2011.0002000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106802e3]
raute: x vs. doppelraute 1Y2.0106802e3]  (((returning 2010.6802000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0113202e3]
raute: x vs. doppelraute 1Y2.0113202e3]  (((returning 2011.3202000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0110002e3]
raute: x vs. doppelraute 1Y2.0110002e3]  (((returning 2011.0002000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0110002e3]
raute: x vs. doppelraute 1Y2.0110002e3]  (((returning 2011.0002000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106802e3]
raute: x vs. doppelraute 1Y2.0106802e3]  (((returning 2010.6802000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0113202e3]
raute: x vs. doppelraute 1Y2.0113202e3]  (((returning 2011.3202000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106003e3]
raute: x vs. doppelraute 1Y2.0106003e3]  (((returning 2010.6003000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0114001e3]
raute: x vs. doppelraute 1Y2.0114001e3]  (((returning 2011.4001000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0106003e3]
raute: x vs. doppelraute 1Y2.0106003e3]  (((returning 2010.6003000000000))) 
INPUT pgfplotstempjuliandate = 1Y2.0114001e3]
Here is the monkeypatched tikzlibrarypgfplots.dateplot.code.tex ``` %-------------------------------------------- % % Package pgfplots, library for high-level coordinates. % % Copyright 2007/2008/2009 by Christian Feuersänger. % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % %-------------------------------------------- \pgfutil@usemodule{pgfcalendar} % Idea: allow %-------------------------------------------------- % \begin{tikzpicture} % \begin{axis}[ % date coordinates in=x, % xticklabel={\day.\month.}, % ] % \addplot coordinates { % (2008-01-5, 5) % (2008-01-12, 10) % (2008-01-16, 20) % }; % \end{axis} % \end{tikzpicture} %-------------------------------------------------- \def\pgfplotslibdateplot@number@to@julian@and@time#1.#2\julianto#3\hourto#4\minuteto#5{% #3=#1 \pgf@xa=0.#2pt \multiply\pgf@xa by24 \afterassignment\pgfplots@gobble@until@relax \c@pgf@countb=\the\pgf@xa\relax \edef#4{\the\c@pgf@countb}% \advance\pgf@xa by-#4pt \multiply\pgf@xa by60 \afterassignment\pgfplots@gobble@until@relax \c@pgf@countb=\the\pgf@xa\relax % round minutes (we may loose precision here) \advance\pgf@xa by-\the\c@pgf@countb pt \ifdim\pgf@xa>0.5pt \advance\c@pgf@countb by1 \ifnum\c@pgf@countb=60 \c@pgf@countb=#4 % \advance\c@pgf@countb by1 \edef#4{\the\c@pgf@countb}% \c@pgf@countb=0 \fi \fi \edef#5{\the\c@pgf@countb}% } % #1 the date % #2 the hours % #3 the minutes % #4 is either empty or is the seconds. % #5 a macro which will be filled with the date part. % #6 the macro which will contain a number in the range [0,1] % representing hours and minutes. % % If you don't have seconds, you have to provide the second ':' sign % as dummy! In that case #4 will be empty. \def\pgfplotslibdateplot@map@time#1 #2:#3:#4\dateto#5\timeto#6{% \pgf@xa=#2pt \divide\pgf@xa by24 \pgf@xb=#3pt \divide\pgf@xb by1440 \advance\pgf@xa by\pgf@xb \ifdim\pgf@xa<0pt \pgf@xa=0pt \else \ifdim\pgf@xa>1pt \pgf@xa=1pt \fi \fi \def#5{#1}% \edef#6{\pgf@sys@tonumber\pgf@xa}% }% \def\pgfplotslibdateplot@discard@zero@dot 0.#1\to#2{\def#2{#1}}% %-------------------------------------------------- %This here extends it to SECONDS, but the precision is too low % \def\pgfplotslibdateplot@map@time#1 #2:#3:#4\dateto#5\timeto#6{% % \pgf@xa=#2pt % \divide\pgf@xa by24 % % % \pgf@xb=#3pt % \divide\pgf@xb by1440 % \advance\pgf@xa by\pgf@xb % % % \def\pgfplots@loc@TMPc{#4}% % \ifx\pgfplots@loc@TMPc\pgfutil@empty % \else % \edef\pgfplots@loc@TMPc{\pgfplotslibdateplot@discard@trailing@colon #4}% % \pgf@xb=\pgfplots@loc@TMPc pt % \divide\pgf@xb by1440 % \divide\pgf@xb by60 % \advance\pgf@xa by\pgf@xb % \fi % % % \ifdim\pgf@xa<0pt % \pgf@xa=0pt % \else % \ifdim\pgf@xa>1pt % \pgf@xa=1pt % \fi % \fi % \def#5{#1}% % \edef#6{\pgf@sys@tonumber\pgf@xa}% % }% % \def\pgfplotslibdateplot@discard@trailing@colon#1:{#1}% %-------------------------------------------------- \let\pgfplots@calender@ZEROSHIFT=\pgfutil@empty \def\pgfplots@dateplot@ensure@ZEROSHIFT#1{% \ifx\pgfplots@calender@ZEROSHIFT\pgfutil@empty \ifx\pgfplots@global@dateplot@defaultshift\pgfutil@empty \pgfplots@log4{dateplot: setting 'date ZERO={#1}' for this axis.}% \pgfplots@dateplot@parse@ZEROSHIFT{#1}% \global\let\pgfplots@global@dateplot@defaultshift=\pgfmathresult \fi % \let\pgfplots@calender@ZEROSHIFT=\pgfplots@global@dateplot@defaultshift \fi }% % defines \pgfplots@calender@ZEROSHIFT to be the zero shift \def\pgfplots@dateplot@get@ZEROSHIFT{% \ifx\pgfplots@calender@ZEROSHIFT\pgfutil@empty \ifx\pgfplots@global@dateplot@defaultshift\pgfutil@empty % should never happen \pgfplots@error{Illegal internal state: no 'date ZERO' value found}% \def\pgfplots@calender@ZEROSHIFT{0}% \else \let\pgfplots@calender@ZEROSHIFT=\pgfplots@global@dateplot@defaultshift \fi \fi }% \def\pgfplots@dateplot@parse@ZEROSHIFT#1{% \begingroup \pgfcalendardatetojulian{#1}\c@pgf@counta \edef\pgfmathresult{\the\c@pgf@counta}% \pgfmath@smuggleone\pgfmathresult \endgroup }% \expandafter\def\expandafter\pgfplots@notify@options@are@set\expandafter{\pgfplots@notify@options@are@set \global\let\pgfplots@global@dateplot@defaultshift=\pgfutil@empty } \usepackage{xstring} \pgfplotsset{ /pgfplots/date ZERO/.code={% \pgfplots@dateplot@parse@ZEROSHIFT{#1}% \let\pgfplots@calender@ZEROSHIFT=\pgfmathresult }, /pgfplots/date coordinates in/.code={% \pgfkeysdef{/pgfplots/#1 coord trafo}{% \begingroup \edef\pgfplotstempjuliandate{##1}% \message{INPUT pgfplotstempjuliandate = \pgfplotstempjuliandate}\relax% \message{raute: #1 vs. doppelraute ##1} % count minuses \StrCount{\pgfplotstempjuliandate}{-}[\tmpcountminuses] %\message{tmpcountminuses \tmpcountminuses} % if two minuses, it is a date \ifnum \tmpcountminuses=2 \message{++DATE++} \message{YES: \pgfplotstempjuliandate is a DATE!} % NOT A NUMBER!!! % check if we also have a TIME like '2006-01-01 11:21' \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}% \ifpgfutil@in@ % we have a TIME! \message{success: value ##1 does have a TIME attached} \expandafter\pgfplotslibdateplot@map@time\pgfplotstempjuliandate:\dateto\pgfplotstempjuliandate\timeto\pgfplotstemptime \else \message{error: value ##1 does NOT have a time attached} \let\pgfplotstemptime=\pgfutil@empty \fi % \expandafter\pgfplots@dateplot@ensure@ZEROSHIFT\expandafter{\pgfplotstempjuliandate}% % \message{pgfplotstempjuliandate = \pgfplotstempjuliandate}% \expandafter\pgfcalendardatetojulian\expandafter{\pgfplotstempjuliandate}\c@pgf@counta\relax% {\advance \c@pgf@counta by -\pgfplots@calender@ZEROSHIFT\relax}% \message{value ##1 is \pgfplotstemptime} \ifx\pgfplotstemptime\pgfutil@empty% % no time: \message{no time} \edef\pgfmathresult{\the\c@pgf@counta}% \else % add time fraction (which should be in the range % [0,1]). \message{add time fraction (which should be in the range} \ifdim\pgfplotstemptime pt<1pt % discard prefix '0.': \message{discard prefix '0.':}% \expandafter\pgfplotslibdateplot@discard@zero@dot\pgfplotstemptime\to\pgfplotstemptime% \edef\pgfmathresult{\the\c@pgf@counta.\pgfplotstemptime}% \else % assume \pgfplotstemptime=1pt : \message{assume \pgfplotstemptime=1pt :} \advance\c@pgf@counta by1 \edef\pgfmathresult{\the\c@pgf@counta}% \fi \fi \else \StrCount{\pgfplotstempjuliandate}{]}[\tmpcountbrackets] % \message{tmpcountbrackets \tmpcountbrackets} \StrCount{\pgfplotstempjuliandate}{.}[\tmpcountdots] % \message{tmpcountdots \tmpcountdots} \StrCount{\pgfplotstempjuliandate}{e}[\tmpcountsmalle] % \message{tmpcountsmalle \tmpcountsmalle} \ifnum \tmpcountbrackets=1 \ifnum \tmpcountdots=1 \ifnum \tmpcountsmalle=1 % \message{**** FUCKING FLOAT ****} % \message{convert \pgfplotstempjuliandate from float to fixed } \pgfmathfloattofixed{\pgfplotstempjuliandate} % \message{converted result: \pgfmathresult } \else \message{*** anything ***} \message{nothing to do, return as is} \edef\pgfmathresult{\pgfplotstempjuliandate} \fi \else \message{*** anything ***} \message{nothing to do, return as is} \edef\pgfmathresult{\pgfplotstempjuliandate} \fi \else \ifnum \tmpcountdots=1 \ifnum \tmpcountsmalle=1 \message{*** SCIENTIFIC NOTATION ***} \else \message{*** FIXED ***} \message{nothing to do, return as is} \edef\pgfmathresult{\pgfplotstempjuliandate} \fi \else \message{*** anything ***} \message{nothing to do, return as is} \edef\pgfmathresult{\pgfplotstempjuliandate} \fi \fi \fi \message{ (((returning \pgfmathresult))) } \pgfmath@smuggleone\pgfmathresult \endgroup }% \pgfkeysdef{/pgfplots/#1 coord inv trafo}{% \edef\pgfplotstempjuliandatenumeric{##1}% \begingroup \message{ OOOOOOOOOOOOOO==OOOOO coord inv trafo:: ##1 #1} \pgfplots@dateplot@get@ZEROSHIFT % \expandafter\pgfplotslibdateplot@number@to@julian@and@time\pgfplotstempjuliandatenumeric\julianto{\c@pgf@counta}\hourto\Hour\minuteto\Minute% \advance\c@pgf@counta by\pgfplots@calender@ZEROSHIFT\relax \expandafter\pgfcalendarjuliantodate\expandafter{\the\c@pgf@counta}\year\month\day \xdef\pgfplotslibdateplot@TMP{% \noexpand\def\noexpand\year{\year}% \noexpand\def\noexpand\month{\month}% \noexpand\def\noexpand\day{\day}% \noexpand\def\noexpand\Hour{\Hour}% \noexpand\def\noexpand\Minute{\Minute}% }% \endgroup \pgfplotslibdateplot@TMP \let\hour=\Hour \let\minute=\Minute \ifnum\hour<10 \edef\hour{0\hour}% \fi \ifnum\minute<10 \edef\minute{0\minute}% \fi \def\Second{0}% \def\second{00}% \edef\lowlevel{##1}% \pgfkeysifdefined{/pgfplots/date default inv/#1}{% \edef\pgfmathresult{\pgfkeysvalueof{/pgfplots/date default inv/#1}}% }{% \edef\pgfmathresult{\year-\month-\day\space\hour:\minute:\second}% }% }% \pgfkeysifdefined{/pgfplots/#1ticklabel/.@cmd}{% \pgfkeysalso{% /pgfplots/#1ticklabel={\tick},% /pgfplots/scaled #1 ticks=false,% /pgfplots/plot coordinates/math parser=false,% }% }{% % OK. The style can be used for other coordinates as well % (like hist/data) }% % \pgfkeysifdefined{/pgfplots/#1 is expr}{% \pgfkeyssetvalue{/pgfplots/#1 is expr}{0}% }{}% % % Allow a callback (optional) \pgfkeysifdefined{/pgfplots/#1/@execute on coord trafo changed/.@cmd}{% \pgfkeysalso {/pgfplots/#1/@execute on coord trafo changed}% }{}% }, /pgfplots/date coordinates in/.value required, % % #1: the argument for 'data coordinates in={#1} % #2: the default for the inverse transformation. If there is % none, a default will be chosen automatically (with full % information) /pgfplots/date coordinates default inverse/.style 2 args={% /pgfplots/date default inv/#1/.initial=#2, }, /pgfplots/date coordinates default inverse={x}{\year-\month-\day}, /pgfplots/date coordinates default inverse={y}{\year-\month-\day}, /pgfplots/date coordinates default inverse={z}{\year-\month-\day}, } ```
bf commented 1 year ago

I have the conversion from boxplot FPU float to dateplot fixed number (+ ZEROSHIFT) working with this code

Modified tikzlibrarypgfplots.dateplot.code.tex ``` %-------------------------------------------- % % Package pgfplots, library for high-level coordinates. % % Copyright 2007/2008/2009 by Christian Feuersänger. % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % %-------------------------------------------- \pgfutil@usemodule{pgfcalendar} % Idea: allow %-------------------------------------------------- % \begin{tikzpicture} % \begin{axis}[ % date coordinates in=x, % xticklabel={\day.\month.}, % ] % \addplot coordinates { % (2008-01-5, 5) % (2008-01-12, 10) % (2008-01-16, 20) % }; % \end{axis} % \end{tikzpicture} %-------------------------------------------------- \def\pgfplotslibdateplot@number@to@julian@and@time#1.#2\julianto#3\hourto#4\minuteto#5{% #3=#1 \pgf@xa=0.#2pt \multiply\pgf@xa by24 \afterassignment\pgfplots@gobble@until@relax \c@pgf@countb=\the\pgf@xa\relax \edef#4{\the\c@pgf@countb}% \advance\pgf@xa by-#4pt \multiply\pgf@xa by60 \afterassignment\pgfplots@gobble@until@relax \c@pgf@countb=\the\pgf@xa\relax % round minutes (we may loose precision here) \advance\pgf@xa by-\the\c@pgf@countb pt \ifdim\pgf@xa>0.5pt \advance\c@pgf@countb by1 \ifnum\c@pgf@countb=60 \c@pgf@countb=#4 % \advance\c@pgf@countb by1 \edef#4{\the\c@pgf@countb}% \c@pgf@countb=0 \fi \fi \edef#5{\the\c@pgf@countb}% } % #1 the date % #2 the hours % #3 the minutes % #4 is either empty or is the seconds. % #5 a macro which will be filled with the date part. % #6 the macro which will contain a number in the range [0,1] % representing hours and minutes. % % If you don't have seconds, you have to provide the second ':' sign % as dummy! In that case #4 will be empty. \def\pgfplotslibdateplot@map@time#1 #2:#3:#4\dateto#5\timeto#6{% \pgf@xa=#2pt \divide\pgf@xa by24 \pgf@xb=#3pt \divide\pgf@xb by1440 \advance\pgf@xa by\pgf@xb \ifdim\pgf@xa<0pt \pgf@xa=0pt \else \ifdim\pgf@xa>1pt \pgf@xa=1pt \fi \fi \def#5{#1}% \edef#6{\pgf@sys@tonumber\pgf@xa}% }% \def\pgfplotslibdateplot@discard@zero@dot 0.#1\to#2{\def#2{#1}}% %-------------------------------------------------- %This here extends it to SECONDS, but the precision is too low % \def\pgfplotslibdateplot@map@time#1 #2:#3:#4\dateto#5\timeto#6{% % \pgf@xa=#2pt % \divide\pgf@xa by24 % % % \pgf@xb=#3pt % \divide\pgf@xb by1440 % \advance\pgf@xa by\pgf@xb % % % \def\pgfplots@loc@TMPc{#4}% % \ifx\pgfplots@loc@TMPc\pgfutil@empty % \else % \edef\pgfplots@loc@TMPc{\pgfplotslibdateplot@discard@trailing@colon #4}% % \pgf@xb=\pgfplots@loc@TMPc pt % \divide\pgf@xb by1440 % \divide\pgf@xb by60 % \advance\pgf@xa by\pgf@xb % \fi % % % \ifdim\pgf@xa<0pt % \pgf@xa=0pt % \else % \ifdim\pgf@xa>1pt % \pgf@xa=1pt % \fi % \fi % \def#5{#1}% % \edef#6{\pgf@sys@tonumber\pgf@xa}% % }% % \def\pgfplotslibdateplot@discard@trailing@colon#1:{#1}% %-------------------------------------------------- \let\pgfplots@calender@ZEROSHIFT=\pgfutil@empty \def\pgfplots@dateplot@ensure@ZEROSHIFT#1{% \ifx\pgfplots@calender@ZEROSHIFT\pgfutil@empty \ifx\pgfplots@global@dateplot@defaultshift\pgfutil@empty \pgfplots@log4{dateplot: setting 'date ZERO={#1}' for this axis.}% \pgfplots@dateplot@parse@ZEROSHIFT{#1}% \global\let\pgfplots@global@dateplot@defaultshift=\pgfmathresult \fi % \let\pgfplots@calender@ZEROSHIFT=\pgfplots@global@dateplot@defaultshift \fi }% % defines \pgfplots@calender@ZEROSHIFT to be the zero shift \def\pgfplots@dateplot@get@ZEROSHIFT{% \ifx\pgfplots@calender@ZEROSHIFT\pgfutil@empty \ifx\pgfplots@global@dateplot@defaultshift\pgfutil@empty % should never happen \pgfplots@error{Illegal internal state: no 'date ZERO' value found}% \def\pgfplots@calender@ZEROSHIFT{0}% \else \let\pgfplots@calender@ZEROSHIFT=\pgfplots@global@dateplot@defaultshift \fi \fi }% \def\pgfplots@dateplot@parse@ZEROSHIFT#1{% \begingroup \pgfcalendardatetojulian{#1}\c@pgf@counta \edef\pgfmathresult{\the\c@pgf@counta}% \pgfmath@smuggleone\pgfmathresult \endgroup }% \expandafter\def\expandafter\pgfplots@notify@options@are@set\expandafter{\pgfplots@notify@options@are@set \global\let\pgfplots@global@dateplot@defaultshift=\pgfutil@empty } \usepackage{xstring} \pgfplotsset{ /pgfplots/date ZERO/.code={% \pgfplots@dateplot@parse@ZEROSHIFT{#1}% \let\pgfplots@calender@ZEROSHIFT=\pgfmathresult }, /pgfplots/date coordinates in/.code={% \pgfkeysdef{/pgfplots/#1 coord trafo}{% \begingroup \edef\pgfplotstempjuliandate{##1}% \message{INPUT pgfplotstempjuliandate = \pgfplotstempjuliandate}\relax% \message{raute: #1 vs. doppelraute ##1} % count minuses \StrCount{\pgfplotstempjuliandate}{-}[\tmpcountminuses] %\message{tmpcountminuses \tmpcountminuses} % if two minuses, it is a date \ifnum \tmpcountminuses=2 \message{++DATE++} \message{YES: \pgfplotstempjuliandate is a DATE!} % NOT A NUMBER!!! % check if we also have a TIME like '2006-01-01 11:21' \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}% \ifpgfutil@in@ % we have a TIME! \message{success: value ##1 does have a TIME attached} \expandafter\pgfplotslibdateplot@map@time\pgfplotstempjuliandate:\dateto\pgfplotstempjuliandate\timeto\pgfplotstemptime \else \message{error: value ##1 does NOT have a time attached} \let\pgfplotstemptime=\pgfutil@empty \fi % \expandafter\pgfplots@dateplot@ensure@ZEROSHIFT\expandafter{\pgfplotstempjuliandate}% % \message{pgfplotstempjuliandate = \pgfplotstempjuliandate }% \expandafter\pgfcalendardatetojulian\expandafter{\pgfplotstempjuliandate}\c@pgf@counta\relax% \message{ZEROSHIFT \pgfplots@calender@ZEROSHIFT } {\advance \c@pgf@counta by -\pgfplots@calender@ZEROSHIFT\relax}% \message{value ##1 is \pgfplotstemptime ||} \ifx\pgfplotstemptime\pgfutil@empty% % no time: \message{no time} \edef\pgfmathresult{\the\c@pgf@counta}% \else % add time fraction (which should be in the range % [0,1]). \message{add time fraction (which should be in the range} \ifdim\pgfplotstemptime pt<1pt % discard prefix '0.': \message{discard prefix '0.':}% \expandafter\pgfplotslibdateplot@discard@zero@dot\pgfplotstemptime\to\pgfplotstemptime% \edef\pgfmathresult{\the\c@pgf@counta.\pgfplotstemptime}% \else % assume \pgfplotstemptime=1pt : \message{assume \pgfplotstemptime=1pt :} \advance\c@pgf@counta by1 \edef\pgfmathresult{\the\c@pgf@counta}% \fi \fi \else \StrCount{\pgfplotstempjuliandate}{]}[\tmpcountbrackets] % \message{tmpcountbrackets \tmpcountbrackets} \StrCount{\pgfplotstempjuliandate}{.}[\tmpcountdots] % \message{tmpcountdots \tmpcountdots} \StrCount{\pgfplotstempjuliandate}{e}[\tmpcountsmalle] % \message{tmpcountsmalle \tmpcountsmalle} \ifnum \tmpcountbrackets>0 \ifnum \tmpcountdots>0 \ifnum \tmpcountsmalle>0 \message{**** FUCKING FLOAT ****} \message{add the zeroshift of \pgfplots@calender@ZEROSHIFT to \pgfplotstempjuliandate} \pgfmathfloatparsenumber{\pgfplots@calender@ZEROSHIFT} \message{zeroshift as float: \pgfmathresult, will add to \pgfplotstempjuliandate} \pgfmathfloatadd@{\pgfmathresult}{\pgfplotstempjuliandate} \message{ -> convert \pgfmathresult from float to fixed } \pgfmathfloattofixed{\pgfmathresult} \message{ -> converted result: \pgfmathresult } \else \message{*** anything ***} \message{nothing to do, return as is} \edef\pgfmathresult{\pgfplotstempjuliandate} \fi \else \message{*** anything ***} \message{nothing to do, return as is} \edef\pgfmathresult{\pgfplotstempjuliandate} \fi \else \ifnum \tmpcountdots=1 \ifnum \tmpcountsmalle=1 \message{*** SCIENTIFIC NOTATION ***} \else \message{*** FIXED ***} \message{nothing to do, return as is} \edef\pgfmathresult{\pgfplotstempjuliandate} \fi \else \message{*** anything ***} \message{nothing to do, return as is} \edef\pgfmathresult{\pgfplotstempjuliandate} \fi \fi \fi \message{ (((returning \pgfmathresult))) } \pgfmath@smuggleone\pgfmathresult \endgroup }% \pgfkeysdef{/pgfplots/#1 coord inv trafo}{% \edef\pgfplotstempjuliandatenumeric{##1}% \begingroup \message{ OOOOOOOOOOOOOO==OOOOO coord inv trafo:: ##1 #1} \pgfplots@dateplot@get@ZEROSHIFT % \expandafter\pgfplotslibdateplot@number@to@julian@and@time\pgfplotstempjuliandatenumeric\julianto{\c@pgf@counta}\hourto\Hour\minuteto\Minute% \advance\c@pgf@counta by\pgfplots@calender@ZEROSHIFT\relax \expandafter\pgfcalendarjuliantodate\expandafter{\the\c@pgf@counta}\year\month\day \xdef\pgfplotslibdateplot@TMP{% \noexpand\def\noexpand\year{\year}% \noexpand\def\noexpand\month{\month}% \noexpand\def\noexpand\day{\day}% \noexpand\def\noexpand\Hour{\Hour}% \noexpand\def\noexpand\Minute{\Minute}% }% \endgroup \pgfplotslibdateplot@TMP \let\hour=\Hour \let\minute=\Minute \ifnum\hour<10 \edef\hour{0\hour}% \fi \ifnum\minute<10 \edef\minute{0\minute}% \fi \def\Second{0}% \def\second{00}% \edef\lowlevel{##1}% \pgfkeysifdefined{/pgfplots/date default inv/#1}{% \edef\pgfmathresult{\pgfkeysvalueof{/pgfplots/date default inv/#1}}% }{% \edef\pgfmathresult{\year-\month-\day\space\hour:\minute:\second}% }% }% \pgfkeysifdefined{/pgfplots/#1ticklabel/.@cmd}{% \pgfkeysalso{% /pgfplots/#1ticklabel={\tick},% /pgfplots/scaled #1 ticks=false,% /pgfplots/plot coordinates/math parser=false,% }% }{% % OK. The style can be used for other coordinates as well % (like hist/data) }% % \pgfkeysifdefined{/pgfplots/#1 is expr}{% \pgfkeyssetvalue{/pgfplots/#1 is expr}{0}% }{}% % % Allow a callback (optional) \pgfkeysifdefined{/pgfplots/#1/@execute on coord trafo changed/.@cmd}{% \pgfkeysalso {/pgfplots/#1/@execute on coord trafo changed}% }{}% }, /pgfplots/date coordinates in/.value required, % % #1: the argument for 'data coordinates in={#1} % #2: the default for the inverse transformation. If there is % none, a default will be chosen automatically (with full % information) /pgfplots/date coordinates default inverse/.style 2 args={% /pgfplots/date default inv/#1/.initial=#2, }, /pgfplots/date coordinates default inverse={x}{\year-\month-\day}, /pgfplots/date coordinates default inverse={y}{\year-\month-\day}, /pgfplots/date coordinates default inverse={z}{\year-\month-\day}, } ```
bf commented 1 year ago

So my current understanding of this issue is that dateplot (tikzlibrarypgfplots.dateplot.code.tex) adds the x coord trafo function to the axis, with which all dates (e.g. 2022-01-01) are converted to x values. Now the LaTeX part of boxplot (tikzlibrarypgfplots.statistics.code.tex) takes these values and gives them to the LUA part of boxplot.

While the LUA part of boxplot is running (stastics.lua), it keeps on calling LaTeX functions, to figure out (x,y) of the boxplot. Both exchange values, and these values are sometimes of the wrong format (FPU float vs. decimal + ZEROSHIFT for date axis).

bf commented 1 year ago

Fix for boxplot reverse-encoding of time axis:


        \pgfkeysdef{/pgfplots/#1 coord inv trafo}{%
            \edef\pgfplotstempjuliandatenumeric{##1}%
            \begingroup
                \pgfplots@dateplot@get@ZEROSHIFT
                \message{ OOOOOOOOOOOOOO==OOOOO coord inv trafo:: ##1 #1 with zeroshift \pgfplots@calender@ZEROSHIFT}
                %
                \expandafter\pgfplotslibdateplot@number@to@julian@and@time\pgfplotstempjuliandatenumeric\julianto{\c@pgf@counta}\hourto\Hour\minuteto\Minute%
                \message{counta value before: \arabic{pgf@counta}}
                \ifnum \arabic{pgf@counta}<\pgfplots@calender@ZEROSHIFT
                    \advance\c@pgf@counta by\pgfplots@calender@ZEROSHIFT\relax
                \fi
                \message{counta value after: \arabic{pgf@counta}}
                \expandafter\pgfcalendarjuliantodate\expandafter{\the\c@pgf@counta}\year\month\day
                \xdef\pgfplotslibdateplot@TMP{%
                    \noexpand\def\noexpand\year{\year}%
                    \noexpand\def\noexpand\month{\month}%
                    \noexpand\def\noexpand\day{\day}%
                    \noexpand\def\noexpand\Hour{\Hour}%
                    \noexpand\def\noexpand\Minute{\Minute}%
                }%
            \endgroup
            \pgfplotslibdateplot@TMP
            \let\hour=\Hour
            \let\minute=\Minute
            \ifnum\hour<10
                \edef\hour{0\hour}%
            \fi
            \ifnum\minute<10
                \edef\minute{0\minute}%
            \fi
            \def\Second{0}%
            \def\second{00}%
            \edef\lowlevel{##1}%
            \pgfkeysifdefined{/pgfplots/date default inv/#1}{%
                \edef\pgfmathresult{\pgfkeysvalueof{/pgfplots/date default inv/#1}}%
            }{%
                \edef\pgfmathresult{\year-\month-\day\space\hour:\minute:\second}%
            }%
            \message{coord inv result for #1 ##1 is \pgfmathresult}%
        }%
bf commented 1 year ago

@muzimuzhi can you please help me? I have spent three days deep diving into the horrible LaTeX syntax and the pgfplots framework. I have identified that the interaction between tikzlibrarypgfplots.dateplot.code.tex and tikzlibrarypgfplots.statistics.code.tex is bugged when handling date coordinates.

I'm quite sure this could be fixed if tikzlibrarypgfplots.statistics.code.tex would check if the x coord trafo function exists for the axis and would call the x coord trafo function and then work with the returning value.

What do you think?

bf commented 1 year ago

I have found a way to check for x coord trafo using \pgfkeysifdefined{/pgfplots/x coord trafo/.@cmd}{}{}, but I don't know how to execute this function from within tikzlibrarypgfplots.statistics.code.tex with the ##1 parameter.

I have tried \pgfkeysvalueof{/pgfplots/x coord trafo/.@cmd}}{##1} but it gives an error.

Thank you.

muzimuzhi commented 1 year ago

The attempt below seems to work.

Update: To be a serious patch, library dateplot can turn on some boolean whose value is tested in the central pgfplots.code.tex and library files. Currently dateplot is incompatible with many pgfplots components, see https://github.com/pgf-tikz/pgfplots/labels/dateplot.

Notable changes:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{dateplot, groupplots, statistics}
\usepackage{pgfcalendar}

\usepackage{xpatch}
\makeatletter
% defined in tikzlibrarypgfplots.dateplot.code.tex
\pgfkeysgetvalue{/pgfplots/date coordinates in/.@cmd}{\pgfkeys@code}
\xpatchcmd\pgfkeys@code
  {%
    \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}%
  }
  {%
    \expandafter\pgfutil@in@\expandafter Y\expandafter{\pgfplotstempjuliandate}%
    \ifpgfutil@in@
      % convert float to fixed number, then to integer, finally to date
      \begingroup
      \pgfmathfloattofixed{\pgfplotstempjuliandate}%
      % quick \pgfmathfloatround@
      \pgfkeysvalueof{/pgf/number format/precision/.@cmd}0\pgfeov
      \pgfmathroundto{\pgfmathresult}%
      \pgfcalendarjuliantodate{\pgfmathresult}{\year}{\month}{\day}%
      \edef\pgfplotstempjuliandate{\year-\month-\day}%
      \pgfmath@smuggleone\pgfplotstempjuliandate
      \endgroup
    \fi
    \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}%
  }
  {}{\PatchFailed}
\pgfkeyslet{/pgfplots/date coordinates in/.@cmd}{\pgfkeys@code}

% new handler "/.date to julian"
\pgfkeys{
  /handlers/.date to julian/.code={%
    \pgfcalendardatetojulian{#1}\pgfcalendarcurrentjulian
    \pgfkeysalso{\pgfkeyscurrentpath=\the\pgfcalendarcurrentjulian}%
  }
}
\makeatother

\begin{document}
\begin{tikzpicture}
  \begin{groupplot}[
    group style={group size=1 by 1},
    date coordinates in=x,
    xmin=2013-01-01,
    xmax=2013-12-01,
    xticklabel style={rotate=90}
  ]
    \nextgroupplot[boxplot/draw direction=y]
    \addplot+[
      boxplot prepared={
        lower whisker=1, upper whisker=5, lower quartile=2, upper quartile=4, median=3,
        draw position/.date to julian=2013-06-01
      }] coordinates {};
  \end{groupplot}
\end{tikzpicture}
\end{document}

image

bf commented 1 year ago

OMG you fixed it!!!! Thank you so much!!!

Is there a way we can turn this into a patch? Is there anything I can contribute?

image

\documentclass[12pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{statistics}
\usepgfplotslibrary{dateplot}
\pgfplotsset{lua backend=true}
\usepackage{xpatch}
\makeatletter
% defined in tikzlibrarypgfplots.dateplot.code.tex
\pgfkeysgetvalue{/pgfplots/date coordinates in/.@cmd}{\pgfkeys@code}
\xpatchcmd\pgfkeys@code
  {%
    \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}%
  }
  {%
    \expandafter\pgfutil@in@\expandafter Y\expandafter{\pgfplotstempjuliandate}%
    \ifpgfutil@in@
      % convert float to fixed number, then to integer, finally to date
      \begingroup
      \pgfmathfloattofixed{\pgfplotstempjuliandate}%
      % quick \pgfmathfloatround@
      \pgfkeysvalueof{/pgf/number format/precision/.@cmd}0\pgfeov
      \pgfmathroundto{\pgfmathresult}%
      \pgfcalendarjuliantodate{\pgfmathresult}{\year}{\month}{\day}%
      \edef\pgfplotstempjuliandate{\year-\month-\day}%
      \pgfmath@smuggleone\pgfplotstempjuliandate
      \endgroup
    \fi
    \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}%
  }
  {}{\PatchFailed}
\pgfkeyslet{/pgfplots/date coordinates in/.@cmd}{\pgfkeys@code}

% new handler "/.date to julian"
\pgfkeys{
  /handlers/.date to julian/.code={%
    \pgfcalendardatetojulian{#1}\pgfcalendarcurrentjulian
    \pgfkeysalso{\pgfkeyscurrentpath=\the\pgfcalendarcurrentjulian}%
  }
}
\makeatother
\begin{document}

    \begin{figure}
        \begin{tikzpicture}

            \begin{axis}[
                group style={
                    group size=1 by 1,
                }, 
                ymin={0},
                ymax={10},
                xmin={2020-01-01},
                xmax={2022-01-01},
                boxplot/draw direction=y,
                boxplot/box extend=100,
                boxplot/draw position/.date to julian={2021-02-02},
                % use fpu=false,
                date coordinates in=x,
                date ZERO={2020-01-01},
                xtick={2020-01-01, 2021-01-01, 2022-01-01}
            ]

            \addplot+[
                boxplot prepared={
                    lower whisker=1.1, 
                    upper whisker=5.1, 
                    lower quartile=2.1, 
                    upper quartile=4.1, 
                    median=3.1, 
                },
                blue, mark=x
            ] coordinates { 
                % coords will always be printed on top of the boxplot
                (0, 1)
                (0, 2)
                (0, 9)
            };

            \addplot[red, mark=x] coordinates {
                (2020-01-01, 5)
                (2020-06-01, 5)
                (2021-01-01, 5)
            };
            \end{axis}

        \end{tikzpicture}
    \end{figure}
\end{document}
muzimuzhi commented 1 year ago

Is there a way we can turn this into a patch?

Unfortunately the attempt in my previous comment is not qualified as a patch. It is incomplete (date with time is not supported), the if-float test (if the value contains Y) is fragile, and there still exists many more incompatibilities between dateplot library and other pgfplots components, for example keys that accept a full or axis-specific coordinate.

bf commented 1 year ago

Ok so the hacky workaround works, thank you. I'll close this.

muzimuzhi commented 1 year ago

This issue did report a representitave compatibility problem between pgfplots libraries, so I'll reopen it to keep a track of bugs.