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 question title explains it all, my plot isn't looking nice. I want to increase the spacing between each xtick, make the first xtick nearer the y axis and remove that space with no x ticks on the right side of the plot.

If possible, also indicate how can I set each legend's color/drawing, because each legend column's have a lot in commom, so I wanted to make each legend in a column have the same color but different drawing. I don't know if anyone will understand this, but I tried.

Here's the output:

output

My code is HUGE, but here it is:

    \documentclass{standalone}
    \usepackage{booktabs}
    \usepackage{pgfplotstable}

    \usepackage{pgfplots}



    \begin{document}

    \begin{tikzpicture}
    \begin{axis}[
    height=10cm,
    width=15cm,
    grid=major,
    legend columns = 3,
    legend style={
    at={(0.5,-0.15)},
    anchor = north},
    xtick = data,
    xlabel = Rodadas,
    ylabel = Qualidade,
    ]


\addplot coordinates {
(1, 0.678806)
(2, 0.707318)
(3, 0.735688)
(4, 0.758773)
(5, 0.850093)
(6, 0.850093)
(7, 0.850093)
(8, 0.850093)
(9, 0.850093)
(10, 0.871927)
(11, 0.871927)
(12, 0.871927)
(13, 0.871927)
(14, 0.871927)
(15, 0.871927)
(16, 0.873799)
(17, 0.875102)
(18, 0.914746)
(19, 0.914746)
(20, 0.914746)
(21, 0.914746)
(22, 0.914746)
(23, 0.914746)
(24, 0.914746)
(25, 0.914746)
(26, 0.914746)
(27, 0.914746)
(28, 0.914746)
(29, 0.914746)
(30, 0.914746)
};

\addplot coordinates {
(1, 0.755057)
(2, 0.770508)
(3, 0.786410)
(4, 0.817386)
(5, 0.835345)
(6, 0.837206)
(7, 0.841269)
(8, 0.850456)
(9, 0.855433)
(10, 0.856709)
(11, 0.865922)
(12, 0.866900)
(13, 0.884384)
(14, 0.904939)
(15, 0.909285)
(16, 0.909285)
(17, 0.912864)
(18, 0.922196)
(19, 0.942011)
(20, 0.945971)
(21, 0.945971)
(22, 0.946822)
(23, 0.949695)
(24, 0.951748)
(25, 0.955744)
(26, 0.955744)
(27, 0.955744)
(28, 0.955744)
(29, 0.955744)
(30, 0.955830)
};

\addplot coordinates {
(1, 0.779965)
(2, 0.805282)
(3, 0.822174)
(4, 0.831721)
(5, 0.871130)
(6, 0.883848)
(7, 0.889126)
(8, 0.891892)
(9, 0.915892)
(10, 0.932662)
(11, 0.937660)
(12, 0.941063)
(13, 0.954651)
(14, 0.954651)
(15, 0.954651)
(16, 0.954651)
(17, 0.955258)
(18, 0.964528)
(19, 0.964528)
(20, 0.966332)
(21, 0.972416)
(22, 0.973069)
(23, 0.973069)
(24, 0.973069)
(25, 0.975399)
(26, 0.976746)
(27, 0.978759)
(28, 0.986392)
(29, 0.989421)
(30, 0.989421)
};

\addplot coordinates {
(1, 0.248592)
(2, 0.270525)
(3, 0.270525)
(4, 0.274079)
(5, 0.274079)
(6, 0.274079)
(7, 0.276394)
(8, 0.276394)
(9, 0.276394)
(10, 0.276394)
(11, 0.277121)
(12, 0.277121)
(13, 0.277121)
(14, 0.277121)
(15, 0.277121)
(16, 0.277121)
(17, 0.277121)
(18, 0.277121)
(19, 0.291238)
(20, 0.291238)
(21, 0.308117)
(22, 0.316756)
(23, 0.316756)
(24, 0.316756)
(25, 0.316756)
(26, 0.316756)
(27, 0.316756)
(28, 0.316756)
(29, 0.316756)
(30, 0.316756)
};

\addplot coordinates {
(1, 0.301701)
(2, 0.301701)
(3, 0.301701)
(4, 0.301701)
(5, 0.301701)
(6, 0.347555)
(7, 0.347555)
(8, 0.347555)
(9, 0.347555)
(10, 0.347555)
(11, 0.347555)
(12, 0.347555)
(13, 0.347555)
(14, 0.347555)
(15, 0.347555)
(16, 0.347555)
(17, 0.347555)
(18, 0.347555)
(19, 0.369908)
(20, 0.372418)
(21, 0.372418)
(22, 0.372418)
(23, 0.372418)
(24, 0.372418)
(25, 0.372418)
(26, 0.372418)
(27, 0.372418)
(28, 0.372418)
(29, 0.372418)
(30, 0.372418)
};

\addplot coordinates {
(1, 0.301701)
(2, 0.301701)
(3, 0.308213)
(4, 0.309166)
(5, 0.310629)
(6, 0.324628)
(7, 0.324628)
(8, 0.335789)
(9, 0.338966)
(10, 0.346886)
(11, 0.349949)
(12, 0.350236)
(13, 0.355030)
(14, 0.358046)
(15, 0.358046)
(16, 0.360049)
(17, 0.360609)
(18, 0.363103)
(19, 0.367216)
(20, 0.368751)
(21, 0.372306)
(22, 0.376436)
(23, 0.376436)
(24, 0.376436)
(25, 0.376892)
(26, 0.380644)
(27, 0.380780)
(28, 0.385106)
(29, 0.389572)
(30, 0.390048)
};


    \legend{32-2 com busca local, 128-4 com busca local, 256-8 com busca local, 32-2 sem busca local, 128-4 sem busca local, 256-8 sem busca local}



    \end{axis}
    \end{tikzpicture}

    \end{document}
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

To remove the empty space on the left and right edge, you can set enlarge x limits=false.

To influence the plot styles, you can either provide options like red, mark=* to the \addplot [...] options, or you can set a cycle list that takes a list of plot styles.

    \documentclass{standalone}
    \usepackage{booktabs}
    \usepackage{pgfplotstable}

    \usepackage{pgfplots}



    \begin{document}

    \begin{tikzpicture}
    \begin{axis}[
    height=10cm,
    width=15cm,
    grid=major,
    enlarge x limits=false,
    legend columns = 3,
    legend style={
    at={(0.5,-0.15)},
    anchor = north},
    xtick = data,
    xlabel = Rodadas,
    ylabel = Qualidade,
    cycle list={
        cyan, mark=*, mark options={fill=white}\\
        orange, mark=*, mark options={fill=white}\\
        green!70!black, mark=*, mark options={fill=white}\\
        cyan, mark=*, mark options={fill=gray!80}\\
        orange, mark=*, mark options={fill=gray!80}\\
        green!70!black, mark=*, mark options={fill=gray!80}\\
    }
    ]


\addplot coordinates {
(1, 0.678806)
(2, 0.707318)
(3, 0.735688)
(4, 0.758773)
(5, 0.850093)
(6, 0.850093)
(7, 0.850093)
(8, 0.850093)
(9, 0.850093)
(10, 0.871927)
(11, 0.871927)
(12, 0.871927)
(13, 0.871927)
(14, 0.871927)
(15, 0.871927)
(16, 0.873799)
(17, 0.875102)
(18, 0.914746)
(19, 0.914746)
(20, 0.914746)
(21, 0.914746)
(22, 0.914746)
(23, 0.914746)
(24, 0.914746)
(25, 0.914746)
(26, 0.914746)
(27, 0.914746)
(28, 0.914746)
(29, 0.914746)
(30, 0.914746)
};

\addplot coordinates {
(1, 0.755057)
(2, 0.770508)
(3, 0.786410)
(4, 0.817386)
(5, 0.835345)
(6, 0.837206)
(7, 0.841269)
(8, 0.850456)
(9, 0.855433)
(10, 0.856709)
(11, 0.865922)
(12, 0.866900)
(13, 0.884384)
(14, 0.904939)
(15, 0.909285)
(16, 0.909285)
(17, 0.912864)
(18, 0.922196)
(19, 0.942011)
(20, 0.945971)
(21, 0.945971)
(22, 0.946822)
(23, 0.949695)
(24, 0.951748)
(25, 0.955744)
(26, 0.955744)
(27, 0.955744)
(28, 0.955744)
(29, 0.955744)
(30, 0.955830)
};

\addplot coordinates {
(1, 0.779965)
(2, 0.805282)
(3, 0.822174)
(4, 0.831721)
(5, 0.871130)
(6, 0.883848)
(7, 0.889126)
(8, 0.891892)
(9, 0.915892)
(10, 0.932662)
(11, 0.937660)
(12, 0.941063)
(13, 0.954651)
(14, 0.954651)
(15, 0.954651)
(16, 0.954651)
(17, 0.955258)
(18, 0.964528)
(19, 0.964528)
(20, 0.966332)
(21, 0.972416)
(22, 0.973069)
(23, 0.973069)
(24, 0.973069)
(25, 0.975399)
(26, 0.976746)
(27, 0.978759)
(28, 0.986392)
(29, 0.989421)
(30, 0.989421)
};

\addplot coordinates {
(1, 0.248592)
(2, 0.270525)
(3, 0.270525)
(4, 0.274079)
(5, 0.274079)
(6, 0.274079)
(7, 0.276394)
(8, 0.276394)
(9, 0.276394)
(10, 0.276394)
(11, 0.277121)
(12, 0.277121)
(13, 0.277121)
(14, 0.277121)
(15, 0.277121)
(16, 0.277121)
(17, 0.277121)
(18, 0.277121)
(19, 0.291238)
(20, 0.291238)
(21, 0.308117)
(22, 0.316756)
(23, 0.316756)
(24, 0.316756)
(25, 0.316756)
(26, 0.316756)
(27, 0.316756)
(28, 0.316756)
(29, 0.316756)
(30, 0.316756)
};

\addplot coordinates {
(1, 0.301701)
(2, 0.301701)
(3, 0.301701)
(4, 0.301701)
(5, 0.301701)
(6, 0.347555)
(7, 0.347555)
(8, 0.347555)
(9, 0.347555)
(10, 0.347555)
(11, 0.347555)
(12, 0.347555)
(13, 0.347555)
(14, 0.347555)
(15, 0.347555)
(16, 0.347555)
(17, 0.347555)
(18, 0.347555)
(19, 0.369908)
(20, 0.372418)
(21, 0.372418)
(22, 0.372418)
(23, 0.372418)
(24, 0.372418)
(25, 0.372418)
(26, 0.372418)
(27, 0.372418)
(28, 0.372418)
(29, 0.372418)
(30, 0.372418)
};

\addplot coordinates {
(1, 0.301701)
(2, 0.301701)
(3, 0.308213)
(4, 0.309166)
(5, 0.310629)
(6, 0.324628)
(7, 0.324628)
(8, 0.335789)
(9, 0.338966)
(10, 0.346886)
(11, 0.349949)
(12, 0.350236)
(13, 0.355030)
(14, 0.358046)
(15, 0.358046)
(16, 0.360049)
(17, 0.360609)
(18, 0.363103)
(19, 0.367216)
(20, 0.368751)
(21, 0.372306)
(22, 0.376436)
(23, 0.376436)
(24, 0.376436)
(25, 0.376892)
(26, 0.380644)
(27, 0.380780)
(28, 0.385106)
(29, 0.389572)
(30, 0.390048)
};


    \legend{32-2 com busca local, 128-4 com busca local, 256-8 com busca local, 32-2 sem busca local, 128-4 sem busca local, 256-8 sem busca local}



    \end{axis}
    \end{tikzpicture}

    \end{document}
share|improve this answer
    
That was fast. Thanks. I think I'll have to adjust the colors a little so they are more visible. –  polar Dec 10 '12 at 19:29
    
You were faster. Anyway, if you want to manually set the distance from the first xtick (and last) to the y axis you can use enlarge x limits = {true, abs value = 5mm}. About the distance between ticks my idea is not very good (xtick={1,5,10,...,30}), so I hope other answer it. –  Manuel Dec 10 '12 at 19:37
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.