我尝试获取与图片上相同的标记,但它们并不相同:
\documentclass[tikz,border=3.14pt]{standalone}
\usetikzlibrary{calc}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.5\textwidth}
\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
line width=0.5,
grid=major, % Display a grid
tick label style={font={\tiny }},
legend style={nodes={scale=0.6, transform shape}},
label style={font={\tiny }},
legend image post style={},
grid style={white},
xlabel={$k$ Dimensions},
ylabel={RMSE},
y tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=2
},
legend style={at={(1,0.75)}, anchor=north east, draw=none, fill=none},
]
\addplot[mark=o,blue] coordinates
{(2,0.95268) (4,0.9435) (6,0.9390) (8,0.9421) (10,0.9371)(12, 0.9370) (14,0.9357) (16,0.9357) (18,0.9360) (20,0.9364) (22,0.9353) (24,0.9338) (26,0.9343)
(28,0.9360)(30,0.9343)(32,0.9352)(34,0.9343)(36,0.9349)(38,0.9351) (40,0.9342)(42,0.9350)(44,0.9343)(46,0.9344) (48,0.9335) (50,0.9355)
};
\addlegendentry{Valiation}
\addplot[mark=diamond*,mark options={fill=red}] coordinates
{ (2, 0.9174) (4,0.8977) (6,0.8845) (8,0.8803) (10,0.8683)(12, 0.8606) (14, 0.8524) (16,0.8460) (18,0.8391) (20,0.8326) (22,0.8262) (24,0.8199) (26,0.8141)
(28,0.8093)(30,0.8018)(32,0.7987)(34,0.7924)(36,0.7874)(38,0.7819) (40,0.7775)(42,0.7724)(44,0.7674)(46,0.7630) (48,0.7584) (50,0.7543)
};
\addlegendentry{Train}
\end{axis}
\end{tikzpicture}
\subcaption{ML 100K}
\label{sub111}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
line width=0.5,
grid=major, % Display a grid
tick label style={font={\tiny}},
legend style={nodes={scale=0.6, transform shape}},
label style={font={\tiny }},
legend image post style={},
grid style={white},
xlabel={$k$ Dimensions},
ylabel={RMSE},
y tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=2
},
legend style={at={(1,0.75)}, anchor=north east, draw=none, fill=none},
]
\addplot[mark=diamond*,mark options={fill=blue!50}] coordinates
{(2,0.8943) (4,0.8816) (6,0.8751) (8,0.8713) (10,0.8691)(12, 0.8675) (14,0.8661) (16,0.8663) (18,0.8657) (20,0.8642) (22,0.8644) (24,0.8637) (26,0.8640)
(28,0.8640)(30,0.8635)(32,0.8639)(34,0.8636)(36,0.8635)(38,0.8637) (40,0.8639)(42,0.8642)(44,0.8640)(46,0.8641) (48,0.8638) (50,0.8640)
};
\addlegendentry{Validation}
\addplot[mark=diamond*,mark options={fill=red}] coordinates
{ (2, 0.8780) (4,0.8569) (6,0.8428) (8,0.8326) (10,0.8249)(12, 0.8175) (14, 0.8114) (16,0.8063) (18,0.8010) (20,0.7950) (22,0.7909) (24,0.7860) (26,0.7821)
(28,0.7780)(30,0.7737)(32,0.7700)(34,0.7655)(36,0.7615)(38,0.7587) (40,0.7548)(42,0.7510)(44,0.7481)(46,0.7442) (48,0.7405) (50,0.7372)
};
\addlegendentry{Train}
\end{axis}
\end{tikzpicture}
\subcaption{ML 1M}
\label{marcost}
\end{subfigure}
\caption{Bla}
\label{tablex1}
\end{figure}
\end{document}
答案1
您在寻找吗mark size
?
\documentclass{article}
\usepackage{subcaption}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}
\usetikzlibrary{calc}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.49\textwidth}
\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
line width=0.5,
grid=major, % Display a grid
tick label style={font={\tiny }},
legend style={nodes={scale=0.6, transform shape}},
label style={font={\tiny }},
legend image post style={},
grid style={white},
xlabel={$k$ Dimensions},
ylabel={RMSE},
y tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=2
},
legend style={at={(1,0.75)}, anchor=north east, draw=none, fill=none},
]
\addplot[mark=o,blue,mark size=1pt] coordinates
{(2,0.95268) (4,0.9435) (6,0.9390) (8,0.9421) (10,0.9371)(12, 0.9370) (14,0.9357) (16,0.9357) (18,0.9360) (20,0.9364) (22,0.9353) (24,0.9338) (26,0.9343)
(28,0.9360)(30,0.9343)(32,0.9352)(34,0.9343)(36,0.9349)(38,0.9351) (40,0.9342)(42,0.9350)(44,0.9343)(46,0.9344) (48,0.9335) (50,0.9355)
};
\addlegendentry{Valiation}
\addplot[mark=diamond*,mark options={fill=red,mark size=1.5pt,thin}] coordinates
{ (2, 0.9174) (4,0.8977) (6,0.8845) (8,0.8803) (10,0.8683)(12, 0.8606) (14, 0.8524) (16,0.8460) (18,0.8391) (20,0.8326) (22,0.8262) (24,0.8199) (26,0.8141)
(28,0.8093)(30,0.8018)(32,0.7987)(34,0.7924)(36,0.7874)(38,0.7819) (40,0.7775)(42,0.7724)(44,0.7674)(46,0.7630) (48,0.7584) (50,0.7543)
};
\addlegendentry{Train}
\end{axis}
\end{tikzpicture}
\subcaption{ML 100K}
\label{sub111}
\end{subfigure}%
\begin{subfigure}[b]{0.49\textwidth}
\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
line width=0.5,
grid=major, % Display a grid
tick label style={font={\tiny}},
legend style={nodes={scale=0.6, transform shape}},
label style={font={\tiny }},
legend image post style={},
grid style={white},
xlabel={$k$ Dimensions},
ylabel={RMSE},
y tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=2
},
legend style={at={(1,0.75)}, anchor=north east, draw=none, fill=none},
]
\addplot[mark=diamond*,mark options={fill=blue!50,mark size=1.5pt,thin}] coordinates
{(2,0.8943) (4,0.8816) (6,0.8751) (8,0.8713) (10,0.8691)(12, 0.8675) (14,0.8661) (16,0.8663) (18,0.8657) (20,0.8642) (22,0.8644) (24,0.8637) (26,0.8640)
(28,0.8640)(30,0.8635)(32,0.8639)(34,0.8636)(36,0.8635)(38,0.8637) (40,0.8639)(42,0.8642)(44,0.8640)(46,0.8641) (48,0.8638) (50,0.8640)
};
\addlegendentry{Validation}
\addplot[mark=diamond*,mark options={fill=red,mark size=1.5pt,thin}] coordinates
{ (2, 0.8780) (4,0.8569) (6,0.8428) (8,0.8326) (10,0.8249)(12, 0.8175) (14, 0.8114) (16,0.8063) (18,0.8010) (20,0.7950) (22,0.7909) (24,0.7860) (26,0.7821)
(28,0.7780)(30,0.7737)(32,0.7700)(34,0.7655)(36,0.7615)(38,0.7587) (40,0.7548)(42,0.7510)(44,0.7481)(46,0.7442) (48,0.7405) (50,0.7372)
};
\addlegendentry{Train}
\end{axis}
\end{tikzpicture}
\subcaption{ML 1M}
\label{marcost}
\end{subfigure}
\caption{Bla}
\label{tablex1}
\end{figure}
\end{document}
顺便说一句,对于带有子图的东西使用独立程序可能不是最佳选择。