我需要获取 x 轴上给出的精确值。意思是 0.01、0.03、0.05、0.07、0.2、0.5、1。而不是图像中现在出现的那些值。还有 y 轴值。
\documentclass{standalone}
\usepackage{subcaption}
\usepackage{caption}
\usepackage{pgfplots, pgfplotstable}
\usetikzlibrary{positioning}
\pgfplotsset{compat=1.16,width=0.98\textwidth}
%\pgfplotsset{compat=1.16,width=0.98\textwidth}
\usepackage{tikz}
\usepackage[english,spanish]{babel} % multilenguaje
% grid style
\pgfdeclareplotmark{mystar}{
\node[star,star point ratio=2.25,minimum size=6pt,
inner sep=0pt,draw=black,solid,fill=red] {};
}
\decimalpoint
\definecolor{color0}{rgb}{1,1,0}
\definecolor{color1}{rgb}{1,0.647058823529412,0}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis line style={black},
scaled x ticks = false,
legend cell align={left},
legend style={at={(0.97,0.03)}, anchor=south east, draw=black},
tick align=outside,
x grid style={dashed,black!60},
xlabel={$\lambda$},
xmajorticks=true,
xmin=-0.0395, xmax=1.0495,
xtick style={color=black},
y grid style={dashed,black!60},
ylabel={RMSE},
ymajorticks=true,
ymin=0.846942213907375, ymax=0.970121133137966,
ytick style={black},
xtick align=inside,
ytick align=inside,
grid = none,
y tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=4
},
]
\addplot [mark =,line width=0.7pt,blue, mark size=2pt]
table {
0.01 0.8822
0.03 0.8615
0.05 0.854
0.07 0.8597
0.2 0.9155
0.5 0.9344
1 0.9639
};
\addlegendentry{20 f}
\addplot [line width=0.7pt ,black]
table {%
0.01 0.898481256113781
0.03 0.865873246257198
0.05 0.853726601717427
0.07 0.857932550788363
0.2 0.915144334833605
0.5 0.934927092350177
1 0.964522091354758
};
\addlegendentry{30 f}
\addplot [line width=0.7pt, red]
table {%
0.01 0.922581329120646
0.03 0.872177303638855
0.05 0.853365286503622
0.07 0.856359118109799
0.2 0.914724879701767
0.5 0.93512077918702
1 0.964292857206321
};
\addlegendentry{50 f}
\addplot [line width=0.7pt, yellow]
table {%
0.01 0.950247302117098
0.03 0.875862014017094
0.05 0.852945808571336
0.07 0.854889118499624
0.2 0.914000991451563
0.5 0.935209713188576
1 0.963770499326312
};
\addlegendentry{100 f}
\addplot [line width=0.7pt, orange]
table {%
0.01 0.951706952935797
0.03 0.873982593809665
0.05 0.852541255690584
0.07 0.854396792085605
0.2 0.913496001521785
0.5 0.934766529974339
1 0.963747053113756
};
\addlegendentry{150 f}
\end{axis}
\end{tikzpicture}
\end{document}