
奇数を表示するにはどうすればいいですかxticklabels
?
コード:
\documentclass[margin=3mm]{standalone}
\usepackage[english,spanish]{babel} % multilenguaje
\usepackage{pgfplots}
\usetikzlibrary{babel,
positioning}
\pgfplotsset{compat=1.16,width=0.98\linewidth}
\usepackage{filecontents}
\begin{filecontents}{performance.data}
x A B C D E F
0.01 0.9126 0.9126 0.9313 0.9494 0.9524 0.9462
0.02 0.8872 0.8872 0.8980 0.9044 0.9014 0.8966
0.03 0.8713 0.8713 0.8747 0.8767 0.8737 0.8722
0.05 0.8549 0.8549 0.8552 0.8541 0.8538 0.8532
0.09 0.8710 0.8710 0.8700 0.8687 0.8676 0.8667
0.10 0.8782 0.8782 0.8771 0.8751 0.8740 0.8738
0.20 0.9301 0.9301 0.9281 0.9275 0.9269 0.9271
\end{filecontents}
\decimalpoint
\begin{document}
\begin{tikzpicture}
\begin{axis}[
grid = none,
legend style={at={(0.97,0.03)}, anchor=south east, draw=black},
% legend cell align=left,
% legend pos=north east,
xmin=0.000499999999999999, xmax=0.2095,
ylabel={RMSE},
xlabel={$\lambda$},
%
xticklabel style={font=\small,
/pgf/number format/fixed},
yticklabel style={font=\small},
%
every axis plot post/.append style={line width=1.2pt},
%
mark size=1.3pt,
cycle list={
{blue,mark=*},
{black,mark=*},
{red,mark=*},
{green,mark=*},
{orange,mark=*},
{cyan,mark=*},% <-- don't add a comma here
},
]
\addplot table [y=A] {performance.data};
\addlegendentry{20 f}
\addplot table [y=B] {performance.data};
\addlegendentry{40 f}
\addplot table [y=C] {performance.data};
\addlegendentry{60 f}
\addplot table [y=D] {performance.data};
\addlegendentry{100 f}
\addplot table [y=E] {performance.data};
\addlegendentry{150 f}
\addplot table [y=F] {performance.data};
\addlegendentry{200 f}
\end{axis}
\end{tikzpicture}
\end{document}
答え1
コメントを回答に変換しています。
次のように手動で指定できますxticks
。
xtick={0.01,0.03,...,0.20},
奇数目盛りのみが表示されるようになります。
結果:
\documentclass[margin=3mm]{standalone}
\usepackage[english,spanish]{babel} % multilenguaje
\usepackage{pgfplots}
\usetikzlibrary{babel,positioning}
\pgfplotsset{compat=1.16,width=0.98\linewidth}
\usepackage{filecontents}
\begin{filecontents}{performance.data}
x A B C D E F
0.01 0.9126 0.9126 0.9313 0.9494 0.9524 0.9462
0.02 0.8872 0.8872 0.8980 0.9044 0.9014 0.8966
0.03 0.8713 0.8713 0.8747 0.8767 0.8737 0.8722
0.05 0.8549 0.8549 0.8552 0.8541 0.8538 0.8532
0.09 0.8710 0.8710 0.8700 0.8687 0.8676 0.8667
0.10 0.8782 0.8782 0.8771 0.8751 0.8740 0.8738
0.20 0.9301 0.9301 0.9281 0.9275 0.9269 0.9271
\end{filecontents}
\decimalpoint
\begin{document}
\begin{tikzpicture}
\begin{axis}[
grid = none,
legend style={at={(0.97,0.03)}, anchor=south east, draw=black},
% legend cell align=left,
% legend pos=north east,
xmin=0.000499999999999999, xmax=0.2095,
ylabel={RMSE},
xlabel={$\lambda$},
%
xtick={0.01,0.03,...,0.20},
xticklabel style={font=\small,
/pgf/number format/fixed},
yticklabel style={font=\small},
%
every axis plot post/.append style={line width=1.2pt},
%
mark size=1.3pt,
cycle list={
{blue,mark=*},
{black,mark=*},
{red,mark=*},
{green,mark=*},
{orange,mark=*},
{cyan,mark=*},% <-- don't add a comma here
},
]
\addplot table [y=A] {performance.data};
\addlegendentry{20 f}
\addplot table [y=B] {performance.data};
\addlegendentry{40 f}
\addplot table [y=C] {performance.data};
\addlegendentry{60 f}
\addplot table [y=D] {performance.data};
\addlegendentry{100 f}
\addplot table [y=E] {performance.data};
\addlegendentry{150 f}
\addplot table [y=F] {performance.data};
\addlegendentry{200 f}
\end{axis}
\end{tikzpicture}
\end{document}