pgf 图的“尺寸太大”

pgf 图的“尺寸太大”

下面的代码提示“尺寸太大”,这是什么问题?我想放大 99.8-100,而不是使用 y 轴的对数刻度,我该怎么做?

\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

在日志模式下,ymin=0引发问题。

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

在此处输入图片描述

对于放大,您只需要使用axis环境而不是semilogyaxis使用ymin=99.8

相关内容