代码
\pgfplotsset{mystyle/.style={mark=none}}
\begin{figure}[t!]
\resizebox{.4\textwidth}{!}{\begin{tikzpicture}
\begin{axis}[title=QWS Dataset,
legend pos=outer north east,
ytick={0,0.2,...,1},
legend pos=outer north east,
legend style={draw=none},
xtick={0,1,...,10},
scaled ticks=false,
log ticks with fixed point={1000 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
ylabel = Fitness,
cycle list={
black,thick,densely dotted\\
blue,densely dashed\\
red,solid\\
},
xlabel = Number of Generations,
every axis legend/.append style={xshift=-10pt}
]
%manman
\addplot+[mystyle] plot coordinates{(1,0.1)(2,0.1)(3,0.1)(4,0.1)(5,0.1)(6,0.1)(7,0.1)(8,0.1)(9,0.1)(10,0.1)};
\addplot+[mystyle] plot coordinates{(1,0.5)(2,0.5)(3,0.5)(4,0.5)(5,0.5)(6,0.5)(7,0.5)(8,0.5)(9,0.5)(10,0.5)};
\addplot+[mystyle] plot coordinates{(1,0.8)(2,0.8)(3,0.8)(4,0.8)(5,0.8)(6,0.8)(7,0.8)(8,0.8)(9,0.8)(10,0.8)};
\legend{FV,FC,TAS}
\end{axis}
\end{tikzpicture}}
\caption{Experiment Results}\vspace{-5mm}
\end{figure}
图表
我希望有三行,但是为什么只有两行?
答案1
第三行在那里,但它和 x 轴是叠加的,因为 y 刻度从 0.1 开始。ymin=0
在环境选项中进行设置axis
可以解决问题。
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\pgfplotsset{mystyle/.style={mark=none}}
\begin{figure}[t!]
\resizebox{.4\textwidth}{!}{\begin{tikzpicture}
\begin{axis}[title=QWS Dataset,
legend pos=outer north east,
ytick={0,0.2,...,1},
ymin=0,
ymax=1,
legend pos=outer north east,
legend style={draw=none},
xtick={0,1,...,10},
scaled ticks=false,
log ticks with fixed point={1000 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
ylabel = Fitness,
cycle list={
black,thick,densely dotted\\
blue,densely dashed\\
red,solid\\
},
xlabel = Number of Generations,
every axis legend/.append style={xshift=-10pt}
]
%manman
\addplot+[mystyle] plot coordinates{(1,0.1)(2,0.1)(3,0.1)(4,0.1)(5,0.1)(6,0.1)(7,0.1)(8,0.1)(9,0.1)(10,0.1)};
\addplot+[mystyle] plot coordinates{(1,0.5)(2,0.5)(3,0.5)(4,0.5)(5,0.5)(6,0.5)(7,0.5)(8,0.5)(9,0.5)(10,0.5)};
\addplot+[mystyle] plot coordinates{(1,0.8)(2,0.8)(3,0.8)(4,0.8)(5,0.8)(6,0.8)(7,0.8)(8,0.8)(9,0.8)(10,0.8)};
\legend{FV,FC,TAS}
\end{axis}
\end{tikzpicture}}
\caption{Experiment Results}\vspace{-5mm}
\end{figure}
\end{document}