为什么没有\addplot
忽略NaN
我用来分列的 ?MATLABplot
函数正确地忽略了它们,所以我认为这些列是可以的。此外,在pgfplots
文档中NaN
,建议在需要此类分列时使用 。
哦,我的目的是创建一个网格(由于与颜色和外观无关的其他原因,我不使用 pgfplots 的网格)
我的 MWE 如下(文件.dat
是这里)
\documentclass[a4paper,11pt]{book}
\usepackage{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{geometry}
\usepackage{bm}
\usepackage[super]{nth}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{calc,decorations,patterns,shapes.arrows}
\usepackage{mathtools}
\usepackage{tikzscale}
\usepackage{pgfplots}
\pgfplotscreateplotcyclelist{rgblist}{%
{red,mark=*},
{green,mark=square*},
{blue,mark=triangle*}}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{groupplots}
\usepackage[font=small,
format=hang,
labelfont={sf,bf},
tableposition=top,
figureposition=bottom]{caption}
\begin{document}
\begin{figure}[p]
\centering
\begin{tikzpicture}
\begin{axis}
\addplot[black] table[x=X1,y=Y1] {immagini/data/griglia_psi.dat};
\addplot[black] table[x=X2,y=Y2] {immagini/data/griglia_psi.dat};
\end{axis}
\end{tikzpicture}
\caption{Accuracy accuracy aaaaaccuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy accuracy.}
\label{fig:accuracy}
\end{figure}
\end{document}
答案1
在pgfplots
手册中,有一节关于“中断图”的内容;要执行您想要的操作,您需要unbounded coords=jump
按照以下代码设置选项:
\begin{axis}[unbounded coords=jump]
\addplot[black] table[x=X1,y=Y1] {immagini/data/griglia_psi.dat};
\addplot[black] table[x=X2,y=Y2] {immagini/data/griglia_psi.dat};
\end{axis}