Tikz 错误 ! 尺寸太大

Tikz 错误 ! 尺寸太大
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}

\usepackage[utf8]{inputenc}

\usepackage{tikz,bm,color}
\usetikzlibrary{fit,arrows.meta}

\begin{document}

% with errors
\begin{tikzpicture}[scale=0.075]
\draw[-{Stealth[length=2.5mm]},thin] (-2,0)--(198,0);
\node [below] at (195,0) {\scriptsize{$Q$}};
\draw[-{Stealth[length=2.5mm]},thin] (0,-2)--(0,158);
\node [left] at (0,155) {\scriptsize{$p$}};
\draw [very thick] (0,100) -- (95,100) to [out=0,in=180] (100,100) to [out=0,in=135] (175,85);
\draw [dashed] (0,65) -- (150,65);
\draw [dash dot] (0,141) to [out=0,in=150] (100,100) to [out=330,in=135 (150,65) to [out=315,in=135] (160,55);
\end{tikzpicture}
%! Dimension too large.

% no errors
\begin{tikzpicture}[scale=0.075]
\draw[-{Stealth[length=2.5mm]},thin] (-2,0)--(198,0);
\node [below] at (195,0) {\scriptsize{$Q$}};
\draw[-{Stealth[length=2.5mm]},thin] (0,-2)--(0,158);
\node [left] at (0,155) {\scriptsize{$p$}};
\draw [very thick] (0,100) -- (95,100) -- (100,100) -- (175,85);
\draw [dashed] (0,65) -- (150,65);
\draw [very thick] (0,141) -- (100,100) -- (150,65) -- (160,55);
\end{tikzpicture}
% no errors

\end{document}

我不明白为什么会发生这种事?

答案1

仍然表现出错误的一个最小例子是

\documentclass[tikz]{standalone}
\begin{document}
\tikz\draw (100,100) to [out=0,in=135] (175,85);
\end{document}

我的猜测是计算弧线会导致一些溢出;事实上,您的图片的尺寸在一平方米或多平方米的范围内。

由于你无论如何都会将图片缩放 0.075 倍,因此我建议使用缩放系数 0.75 并将数字缩小 10 倍。命令

\tikz\draw (10.0,10.0) to [out=0,in=135] (17.5,8.5);

没有错误。

这是您修改后的文档和相应的输出。似乎有效。

\documentclass[convert={outext=.jpg}]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\usepackage[utf8]{inputenc}
\usepackage{tikz,bm,color}
\usetikzlibrary{fit,arrows.meta}
\begin{document}
\begin{tikzpicture}[scale=0.75]
  \draw[-{Stealth[length=2.5mm]},thin] (-0.2,0)--(19.8,0);
  \node [below] at (19.5,0) {\scriptsize{$Q$}};
  \draw[-{Stealth[length=2.5mm]},thin] (0,-0.2)--(0,15.8);
  \node [left] at (0,15.5) {\scriptsize{$p$}};
  \draw [very thick] (0,10.0) -- (9.5,10.0) to [out=0,in=180]
    (10.0,10.0) to [out=0,in=135] (17.5,8.5);
  \draw [dashed] (0,6.5) -- (15.0,6.5);
  \draw [dash dot] (0,14.1) to [out=0,in=150]
    (10.0,10.0) to [out=330,in=135] (15.0,6.5)
    to [out=315,in=135] (16.0,5.5);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

\begin{tikzpicture}[x=1.0mm,y=1.0mm]
  \draw[-{Stealth[length=2.5mm]},thin] (-2,0)--(98,0);
  \node [below] at (95,0) {\scriptsize{$t$}};
  \draw[-{Stealth[length=2.5mm]},thin] (0,-2)--(0,78);
  \node [left] at (0,75) {\scriptsize{$Q$}};
  \begin{axis}
  [
anchor=origin,
x=0.5mm, y=0.5mm,
hide axis,
xmin = 0, xmax = 190,
ymin = 0, ymax = 150,
  ]
  \addplot[smooth,dash dot] plot coordinates
  {
(0,100)
(100,100)
(175,85)
  };
  \addplot[smooth,very thick] plot coordinates 
  {
(0,141)
(100,100)
(163,55)
  };
  \addplot[smooth,dashed] plot coordinates
  {
(0,65)
(150,65)
  };
    \end{axis}
\end{tikzpicture}

这是我同时的发现。

相关内容