Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The code

\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} 

the graph enter image description here

I wish to have three lines, but why only two lines are there?

share|improve this question
1  
Is there any particular reason you specify 10 coordinates for the x axis in each horizontal line? You could change those for something like coordinates{(1,0.1)(10,0.1)} and get the same result. –  jja Mar 1 '13 at 12:27
    
@william007 Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Mar 23 '13 at 21:06
add comment

1 Answer

up vote 5 down vote accepted

Your third line is there, but it and the x-axis are superimposed, because your y ticks start at 0.1. Setting ymin=0 in the options of your axis environment solves the problem.

\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}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.