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/
187 stars 33 forks source link

Error by empty lines in table of dateplot #463

Closed spreiter closed 1 year ago

spreiter commented 1 year ago

I am creating a dateplot, but getting error messages for each empty line. It does not seem to be problematic and the PDF is created. Using lualatex on MacOS.

And yes, I need the empty lines in the table to disconnect certain time windows. It is not specific for const plot, I have also seen this behavior in other styles.

Error message:

Missing character: There is no ` (U+0060) in font nullfont!

Package version:

$ tlmgr info pgfplots
package:     pgfplots
category:    Package
shortdesc:   Create normal/logarithmic plots in two and three dimensions
installed:   Yes
revision:    61719
sizes:       src: 1729k, doc: 15893k, run: 3669k
relocatable: No
cat-version: 1.18.1
...

Example:

\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usetikzlibrary{patterns,shapes.arrows}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}

\begin{axis}[
  date coordinates in=x,
  height=5cm,
  tick align=outside,
  width=15cm,
  xlabel={Date},
  xmajorgrids,
  xtick={2020-01-01,2021-01-01},
  xticklabel style={rotate=0.0,anchor=west},
  xticklabel=\year,
]
\addplot [
  const plot,
  semithick,
] table [header=false,col sep=comma] {
  2020-03-04 23:13,0
  2020-06-06 12:30,1
  2020-06-30 00:48,2
  2020-07-01 09:41,3
  2020-07-01 20:46,4
  2020-07-02 07:11,4

  2020-10-30 03:28,5
  2020-11-17 09:36,5
  2020-11-17 17:21,6
  2020-12-18 04:33,6

  2021-02-26 20:15,6
  2021-03-02 17:08,7
  2021-03-23 00:53,7

  2021-03-25 02:38,7
  2021-04-05 10:39,8
  2021-04-07 06:09,8

  2021-04-08 00:44,8
  2021-04-16 22:13,9
  2021-04-16 23:31,10
  2021-04-18 03:33,11
  2021-04-18 04:38,12
  2021-05-10 02:30,13
  2021-05-10 06:10,14
  2021-05-14 11:47,15
  2021-05-14 12:11,16
  2021-05-15 17:03,17
  2021-05-15 19:07,18
  2021-05-15 21:37,19
  2021-07-05 05:59,19

  2021-10-30 07:04,19
  2021-11-05 22:22,20
  2021-11-05 22:52,21
  2021-11-09 11:51,21

  2021-11-11 23:37,21
  2021-11-22 03:39,22
  2021-11-22 03:47,23
  2021-11-29 05:25,23

  2021-11-30 01:54,23
  2021-11-30 11:17,24
  2021-12-04 10:34,25
  2021-12-16 21:58,26
  2021-12-19 04:15,27
  2021-12-19 06:57,28
  2021-12-23 05:00,28
};
\end{axis}

\end{tikzpicture}
\end{document}
ilayn commented 1 year ago

Empty lines have significance in tables, you need to explicitly skip them or place comment characters % at the start of each empty line to keep visual separation but not leaving empty.

spreiter commented 1 year ago

Thanks for the fast reply. But when I add % at the empty lines, all lines in the plot are connected.. Also in the manual it is stated to be a possible scenario that one can use empty lines (chapter 4.3) to jump points.

Or is there another way to create such plot?

ilayn commented 1 year ago

Hmm then I was too fast with my reply, my apologies for the noise. Let me reopen this and wait for a smarter person than me

hmenke commented 1 year ago

Probably a duplicate of #424, which was already fixed in https://github.com/pgf-tikz/pgfplots/commit/a31cac6a9ea2cbabf13962b1c2b2766e2b7d0bf0.

The fix hasn't been released yet, but can be backported by adding

\makeatletter
\def\pgfplotsscanlinelength@nan@pendingwork@PREPARED{%
  \pgfplotsplothandlerappendjumpmarker
  \let\pgfplotsscanlinelength@nan@pendingwork=\relax
}%
\makeatother

to the preamble after \usepackage{pgfplots}.

Also note that “Missing character” is only a warning, not an error, even though some LaTeX editors like showing it as an error.

spreiter commented 1 year ago

Thanks for the explanation. Somehow I missed that ticket.