
상수 함수 f(x)=1을 포함하는 pgf 플롯을 만들려고 합니다. 내 x축은 특정 범위(아래 참조)로 제한되어야 하며, y축에도 제한이 있습니다. 다음은 문제를 재현하는 최소 코드입니다.
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0,
xmax=.1,
ymin=0,
ymax=2]
\addplot {1};
\end{axis}
\end{tikzpicture}
\end{document}
이 코드는 오류를 생성합니다
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 11.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 11.
! Dimension too large.
<recently read> \pgf@xx
l.11 \end{axis}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
오류 메시지의 마지막 7줄이 5번 반복됩니다. 이는 ymin
및 매개변수 에 어떤 값을 사용하더라도 발생 하지만 특정 및 ymax
에 대해서만 발생합니다 . 다른 값을 시도한 결과 LaTeX 가 이를 성공적으로 컴파일하려면 대략 0.15보다 커야 하지만 제 사용 사례에서는 범위가 에서 .xmin
xmax
xmin
xmax
xmin=.0005
xmax=.0027
범위가 너무 작을 때(또는 내 코드에 다른 문제가 있는 경우) LaTeX에서 오류가 발생하는 이유는 무엇입니까?
~ $ pdflatex -version
pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
답변1
당신은 말해야pgfplots
표현식을 작성하고 다음을 제공하십시오 domain
.
\addplot expression[domain=0:1]{1};
% arara: pdflatex
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0,
xmax=.1,
ymin=0,
ymax=2]
\addplot expression[domain=0:1]{1};
\end{axis}
\end{tikzpicture}
\end{document}