6

I have code below which complaining "Dimension too large", what is the problem? And I want to zoom in the 99.8-100 rather than using log scale for y axis, how should I do it?

\documentclass{article}
% GRAPHICS
\usepackage{pgf}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows,automata,positioning}
\begin{document}

\begin{tikzpicture}[font=\sffamily]
\begin{semilogyaxis}[title=\textbf{Anti-correlated dataset},
    legend pos=outer north east,xtick={1,2,3,4,5,6,7,8,9},
        scaled ticks=false,
        log ticks with fixed point,
        ylabel = Optimality (%),
        xlabel = Number of Constraints
]
\addplot plot coordinates{(1,100)(2,100)(3,100)(4,100)(5,100)(6,99.82)(7,99.84)(8,99.59)(9,99.65)};
\addplot plot coordinates{(1,100)(2,100)(3,100)(4,100)(5,100)(6,99.44)(7,100)(8,99.78)(9,99.73)};
\addplot plot coordinates{(1,100)(2,100)(3,100)(4,100)(5,100)(6,99.82)(7,99.74)(8,99.74)(9,99.86)};
\addplot plot coordinates{(1,100)(2,100)(3,100)(4,100)(5,100)(6,99.82)(7,99.74)(8,99.74)(9,99.86)};
\legend{$\kmeans$,$\kmeansskyline$,$\pyramid$,$\pyramidskyline$}
\end{semilogyaxis}
\end{tikzpicture}
 \end{document} 
1
  • Please, don't use nonstandard classes in code examples, if they are not essential for reproducing the problem. Since the same happens with article I edited the question changing the class.
    – egreg
    Nov 24, 2012 at 10:18

1 Answer 1

3

In the log mode, ymin=0 causes the problem.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\begin{semilogyaxis}[title=\textbf{Anti-correlated dataset},
    legend pos=outer north east,xtick={1,2,3,4,5,6,7,8,9},ymin=1,
        scaled ticks=false,
        log ticks with fixed point,
        ylabel = Optimality (\%),
        xlabel = Number of Constraints
]
\addplot coordinates{(1,100)(2,100)(3,100)(4,100)(5,100)(6,99.82)(7,99.84)(8,99.59)(9,99.65)};
\addplot coordinates{(1,100)(2,100)(3,100)(4,100)(5,100)(6,99.44)(7,100)(8,99.78)(9,99.73)};
\addplot coordinates{(1,100)(2,100)(3,100)(4,100)(5,100)(6,99.82)(7,99.74)(8,99.74)(9,99.86)};
\addplot coordinates{(1,100)(2,100)(3,100)(4,100)(5,100)(6,99.82)(7,99.74)(8,99.74)(9,99.86)};
\legend{$k$,$m$,$p$,$ps$}
\end{semilogyaxis}
\end{tikzpicture}
 \end{document} 

enter image description here

For the zoom-in you just need to use an axis environment instead of semilogyaxis and use ymin=99.8.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .