グローバル オプションに従わない最小限のデータで PGFPLOT プロットを修正するにはどうすればよいですか?

グローバル オプションに従わない最小限のデータで PGFPLOT プロットを修正するにはどうすればよいですか?

MWE に示されているように、テスト データが不完全です。プロットで使用可能なすべての (少数の) データ ポイント (銅の場合は (55.16, 0.08)) を使用したいのですが、プロットではそれが考慮されません。また、コンマ区切りなどのグローバル オプションは機能しません (ネイティブの y =0.5 y 目盛りラベルでは機能しますが、追加された y 目盛りラベルでは機能しません)。(ただし、マニュアルのプロットの 1 つでは正常に機能するため、問題はデータおよび/またはプロット オプションにあります。また、プロットで「マークのみ」オプションを使用することができませんでしたが、これはおそらく意味があります。

\documentclass[]{scrartcl}
\usepackage{siunitx}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}


\pgfplotsset{compat=newest,
every linear axis/.append style={
/pgf/number format/use comma,
/pgf/number format/fixed,
}}

\begin{document}

\begin{filecontents}{data-W.csv}
{Stress};{Aluminium};{Copper}
3.44;0.0015;0.001
6.89;0.1;0.002
10.34;0.2; 
11.72; ;0.0068
13.79; ; 
15.51;0.5; 
17.24; ; 
20.68;1;0.01
24.13; ; 
27.58; ; 
31.03; ; 
34.47; ;
37.92; ; 
41.37; ;0.04
44.82; ; 
48.26; ; 
55.16; ;0.08
\end{filecontents}

\pgfplotstableread[col sep=semicolon]{data-W.csv}{\datatableW}

\begin{tikzpicture}
\begin{axis}[
height=.5\textwidth, width=\textwidth,
xticklabel style= {font={\small}},
grid=both,
%xticklabels from table={\datatableW}{[index]0}, %does not accept plot settings
 extra y ticks={.1,.3,.5,.7,.9},  % Did not accept global option but now does
%extra y tick labels={.1,.3,.5,.7,.9} % not necessary now
xlabel={Stress (\si{\mega\pascal})}, 
ylabel={Relaxation (\%)}, 
legend entries={Pure aluminium,Copper}, ]
\addplot [blue,only marks]  table [ 
x index =0, y index=1] {\datatableW};
% x expr=\coordindex, x index =0,{\datatableW}; % Incorrect
\addplot [red,]  table [
x index =0, 
%x expr=\coordindex, x index =0, % incorrect
y index=2] {\datatableW}; 
\end{axis} \end{tikzpicture}

\end{document}

答え1

プロットオプションにいくつかの間違い(および一般的なプロット設定の矛盾)があり、それが問題を引き起こしました。コードを編集してそれらを強調表示して修正しました。オプションがなぜ

xticklabels from  table={\datatableW}{[index]0}

グローバル プロット設定を受け入れないようです。ただし、これを削除すると、プロットがより普通になり、見栄えがよくなり、より論理的になります。

関連情報