3

The code:

\documentclass{standalone}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=1.2]
  \begin{axis}[
    title=Find next vertex,
    xlabel=Cube's $dimension$,
    ylabel=$Time$ (sec),]
    \addplot coordinates {
        (2, 4.86e-07)
    (4, 1.548e-06)
    (8, 2.1081e-05)
    (16, 0.00440496)
    (32, 277.778)
    };
    \addplot [red,mark=*]  coordinates {
        (2, 8.17e-07)
    (4, 2.218e-06)
    (8, 3.0043e-05)
    (16, 0.00721884)
    (32, 296.945)    
    };
  \end{axis}
\end{tikzpicture}
\end{document}

The result:

enter image description here

As you, the first four measurements seem to be equal (which is not the real case) and this happens because the last measurement is significantly larger. Any idea how to cope with this problem?


By using log scale the small values distinguish, but the big ones collide. Maybe I should zoom-in, but no idea how to apply this in my case!

gsamaras
  • 1,443

1 Answers1

3

Considering that the y-values span 8 orders of magnitude, I'd say a logarithmic scale is the way to go here. Also, don't use math mode for italic text, it's semantically wrong, and gives bad output. If you need italic, use \textit{dimension}.

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[scale=1.2]
  \begin{axis}[
    title=Find next vertex,
    xlabel=Cube's dimension,
    ylabel=Time (sec),
    ymode=log]
    \addplot coordinates {
        (2, 4.86e-07)
    (4, 1.548e-06)
    (8, 2.1081e-05)
    (16, 0.00440496)
    (32, 277.778)
    };
    \addplot [red,mark=*]  coordinates {
        (2, 8.17e-07)
    (4, 2.218e-06)
    (8, 3.0043e-05)
    (16, 0.00721884)
    (32, 296.945)    
    };
  \end{axis}
\end{tikzpicture}
\end{document}
Torbjørn T.
  • 206,688