データセットの選択した行のインポート(ヘッダー行なし)

データセットの選択した行のインポート(ヘッダー行なし)

データセットの選択した行のインポート(ヘッダー行なし)

\thisrowno{}インポートでは、行ヘッダーの代わりに列番号を使用する必要があります。pgfplots のマニュアルには、$\mathbbm{N}_0$ の数値を受け取るコマンドを使用する可能性が示されています。

問題なく動作する類似のMWE

次の例は動作しますが (エラー メッセージは表示されません)、意図したものではありません。

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{filecontents}
\begin{filecontents*}{data.dat}
aasd dasdf basdf casdf
1 4 5 1
2 3 1 5
3 5 6 1
4 1 4 9
\end{filecontents*}

\begin{document}
\begin{tikzpicture}
\begin{axis}[%
    xlabel={xlabel},
    ylabel={ylabel}]
\addplot[color=blue,mark=none] 
    table [x=aasd, y=casdf, col sep=space] {data.dat};
\addplot[color=red, mark=none] 
    table [x=aasd, y=basdf, col sep=space] {data.dat};
\end{axis}
\end{tikzpicture}
\end{document}

ここに画像の説明を入力してください

答え1

質問のMWEとの違いは、\thisrow{}または\thisrowno{}表のオプションに別の引数が必要であることです。つまり、

\addplot[mark=none] 
    table [x=aasd, y=casdf, col sep=space] {data.dat};

次のコマンドは同じ結果を示します

\addplot[mark=none] 
    table [x expr=\thisrow{aasd}, y expr=\thisrow{casdf}, col sep=space] {data.dat};

または行番号付き(ヘッダー行なし):

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{filecontents}
\begin{filecontents*}{data.dat}
1 4 5 1
2 3 1 5
3 5 6 1
4 1 4 9
\end{filecontents*}

\begin{document}
\begin{tikzpicture}
\begin{axis}[%
    xlabel={xlabel},
    ylabel={ylabel}]
\addplot[color=blue,mark=none] 
    table [x expr=\thisrowno{0}, y expr=\thisrowno{3}, col sep=space] {data.dat};
\addplot[color=blue,mark=none] 
    table [x expr=\thisrowno{0}, y expr=\thisrowno{2}, col sep=space] {data.dat};
\end{axis}
\end{tikzpicture}
\end{document}

関連情報