
以下は、ファイルからデータを読み込み、x 軸の下のプロットと x 軸自体によって定義された領域を塗りつぶすスクリプトの最小限の例です。入力ファイルは次の場所にあります。
http://expirebox.com/download/0055b781a018392f326c55e6946707ca.html
問題は、コンパイル時にシェーディングが表示されず、問題があることを示すエラーが返されないことです。私は LuaLaTex を使用していますが、XeLaTex と PDFLaTex も試しましたが、いずれもシェーディングが表示されません。パスの定義方法に問題があるのでしょうか、それともデータ自体に問題があるのでしょうか?
\documentclass[preview=true]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}[baseline]
\begin{axis} [name=mainplot,clip mode=individual,
%width=\textwidth,
axis y line=left,
y axis line style=<->,
x axis line style=->,
xlabel={x},
ylabel={y},
xtick align=inside,
ytick align=inside,
axis x line=middle,
xmin=0,
xmax=8,
ymax=0.7,
ytick={-0.1,0,...,0.8},
ymin=-0.1,
minor y tick num =3,
minor x tick num =1,
restrict x to domain=/pgfplots/xmin:/pgfplots/xmax,
]
\addplot[name path=A,blue,thick] table[x=x,y=w] {input_file.txt};
\path[name path=B](\pgfkeysvalueof{/pgfplots/xmin},0)--(\pgfkeysvalueof{/pgfplots/xmax},0);
\addplot fill between[of=A and B,
split,
every segment no 1/.style=
{pattern=north east lines},
every segment no 2/.style=
{fill=none},
];
\end{axis}
\end{tikzpicture}
\end{document}
出力は以下のとおりです。目標は、x 軸の下のプロットで囲まれた領域 (つまり、0 -> ~3) を陰影付けすることです。
よろしくお願いします
イエティ