tikz 绘图上的边距不对称

tikz 绘图上的边距不对称

我正在处理这张图片。它几乎完成了,但出于某种原因,我无法修剪左边距,所以有一些烦人的额外空间。(如果您在新选项卡上打开图像会更容易看到)。它不多,只有几毫米,但我无法摆脱它,它......

在此处输入图片描述

使用的 TeX 代码:

\documentclass{standalone}
\usepackage{newtxtext,newtxmath}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary[patterns]
\begin{document}
\definecolor{wrwrwr}{rgb}{0.3803921568627451,0.3803921568627451,0.3803921568627451}
\definecolor{ffqqqq}{rgb}{1,0,0}
\definecolor{qqffff}{rgb}{0,1,1}
\begin{tikzpicture}[line cap=round,line join=round,x=1cm,y=1cm]
\clip(-0.1,-0.1) rectangle (10.1,10.1);
\fill[line width=0.5pt,fill=black,fill opacity=1] (0,2.831550285182522) -- (1.2143074718385791,2.4846052932286424) -- (1,1.7345291417936148) -- (3.571893165704538,0.9997025230208896) -- (0,1) -- cycle;
\draw[line width=0.5pt] (3.7244944582511232,3.969362889327338) -- (2.4388019300897033,4.336703611659172);
\fill[line width=0.5pt,fill=black,fill opacity=1] (2.1173787980493475,4.42853879224213) -- (2.4388019300897037,4.336703611659171) -- (2.071461207757869,3.0510110834977517) -- (1.7500380757175136,3.1428462640807107) -- cycle;
\fill[line width=0.5pt,fill=black,fill opacity=1] (3.7244944582511232,3.969362889327337) -- (4.045917590291479,3.877527708744379) -- (3.6785768679596447,2.591835180582959) -- (3.3571537359192893,2.6836703611659174) -- cycle;
\fill[line width=0.5pt,fill=black,fill opacity=0.5] (1.2143074718385791,2.4846052932286424) -- (1.4286149436771582,3.234681444663669) -- (0.5,3.5) -- (0.5,9.5) -- (10,9.5) -- (10,10) -- (0,10) -- (0,2.831550285182522) -- cycle;
\fill[line width=0.5pt,fill=black,fill opacity=0.25] (4.230879302730072,7.501565689507412) -- (4.677055650116055,7.033297954435219) -- (2.8039847098272843,5.248592564891289) -- (2.357808362441301,5.716860299963483) -- cycle;
\draw [line width=0.5pt,fill=black,fill opacity=1] (0.5,3.5) circle (0.16169956800273583cm);
\fill[line width=0.5pt,fill=black,pattern=vertical lines,pattern color=black] (3.06020996504959,6.386124821042456) -- (3.5284777001217824,6.8323011684284385) -- (3.0823013527358,7.300568903500631) -- (2.6140336176636074,6.854392556114648) -- cycle;
\fill[line width=0.5pt,fill=black,fill opacity=1] (2.7311005514316555,6.965936642961144) -- (2.9652344189677518,7.189024816654135) -- (2.7421462452747605,7.4231586841902315) -- (2.5080123777386643,7.20007051049724) -- cycle;
\fill[line width=0.5pt,fill=black,fill opacity=0.25] (2.273878510202568,6.976982336804249) -- (2.9762801128108567,7.646246857883223) -- (2.307015591731883,8.34864846049151) -- (1.6046139891235942,7.679383939412538) -- cycle;
\draw [line width=0.5pt] (0,10)-- (10,10);
\draw [line width=0.5pt] (10,10)-- (10,0);
\draw [line width=0.5pt] (10,0)-- (0,0);
\draw [line width=0.5pt] (0,0)-- (0,10);
\draw [line width=0.5pt] (4,2.5)-- (1.4286149436771582,3.234681444663669);
\draw [line width=0.5pt] (1.4286149436771582,3.234681444663669)-- (1,1.7345291417936148);
\draw [line width=0.5pt] (1,1.7345291417936148)-- (3.571893165704538,0.9997025230208896);
\draw [line width=0.5pt] (3.571893165704538,0.9997025230208896)-- (4,2.5);
\draw [line width=0.5pt] (0,2.831550285182522)-- (1.2143074718385791,2.4846052932286424);
\draw [line width=0.5pt] (1.2143074718385791,2.4846052932286424)-- (1,1.7345291417936148);
\draw [line width=0.5pt] (1,1.7345291417936148)-- (3.571893165704538,0.9997025230208896);
\draw [line width=0.5pt] (3.571893165704538,0.9997025230208896)-- (0,1);
\draw [line width=0.5pt] (0,1)-- (0,2.831550285182522);
\draw [line width=0.5pt] (2.1173787980493475,4.42853879224213)-- (2.4388019300897037,4.336703611659171);
\draw [line width=0.5pt] (2.4388019300897037,4.336703611659171)-- (2.071461207757869,3.0510110834977517);
\draw [line width=0.5pt] (2.071461207757869,3.0510110834977517)-- (1.7500380757175136,3.1428462640807107);
\draw [line width=0.5pt] (1.7500380757175136,3.1428462640807107)-- (2.1173787980493475,4.42853879224213);
\draw [line width=0.5pt] (3.7244944582511232,3.969362889327337)-- (4.045917590291479,3.877527708744379);
\draw [line width=0.5pt] (4.045917590291479,3.877527708744379)-- (3.6785768679596447,2.591835180582959);
\draw [line width=0.5pt] (3.6785768679596447,2.591835180582959)-- (3.3571537359192893,2.6836703611659174);
\draw [line width=0.5pt] (3.3571537359192893,2.6836703611659174)-- (3.7244944582511232,3.969362889327337);
\draw [rotate around={74.05460409907717:(4.683670361165922,2.9999891212235843)},line width=0.5pt,color=qqffff,fill=qqffff,fill opacity=0.5] (4.683670361165922,2.9999891212235843) ellipse (0.7173480059425026cm and 0.26000392461716576cm);
\draw [line width=0.5pt,color=ffqqqq] (3.862247229125562,3.2346814446636687) -- (4.683670361165918,2.999989121223567);
\draw [line width=0.5pt,color=ffqqqq] (3.862247229125562,3.2346814446636687) -- (4.729587951457397,3.1607006872437444);
\draw [line width=0.5pt,color=ffqqqq] (3.862247229125562,3.2346814446636687) -- (4.637752770874439,2.8392775552033895);
\draw [line width=0.5pt] (1.4286149436771582,3.234681444663669)-- (1.2143074718385791,2.4846052932286424);
\draw [line width=0.5pt] (1.2143074718385791,2.4846052932286424)-- (3.7859465828522687,1.749851261510445);
\draw [line width=0.5pt] (3.7859465828522687,1.749851261510445)-- (4,2.5);
\draw [line width=0.5pt] (4,2.5)-- (1.4286149436771582,3.234681444663669);
\draw [line width=0.5pt] (1.2143074718385791,2.4846052932286424)-- (1.4286149436771582,3.234681444663669);
\draw [line width=0.5pt] (1.4286149436771582,3.234681444663669)-- (0.5,3.5);
\draw [line width=0.5pt] (0.5,3.5)-- (0.5,9.5);
\draw [line width=0.5pt] (0.5,9.5)-- (10,9.5);
\draw [line width=0.5pt] (10,9.5)-- (10,10);
\draw [line width=0.5pt] (10,10)-- (0,10);
\draw [line width=0.5pt] (0,10)-- (0,2.831550285182522);
\draw [line width=0.5pt] (0,2.831550285182522)-- (1.2143074718385791,2.4846052932286424);
\draw [line width=0.5pt,color=ffqqqq] (4.637752770874439,2.8392775552033895) -- (6.5,2.307206918310372);
\draw [line width=0.5pt,color=ffqqqq] (4.683670361165918,2.999989121223567) -- (7.5,2.195323510128114);
\draw [line width=0.5pt,color=ffqqqq] (4.729587951457397,3.1607006872437444) -- (8.5,2.0834401019458575);
\draw [line width=0.5pt,color=ffqqqq] (8.5,2.0834401019458575) -- (10,2.083440101945857);
\draw [line width=0.5pt,color=ffqqqq] (7.5,2.195323510128114) -- (10,2.1953235101281137);
\draw [line width=0.5pt,color=ffqqqq] (6.5,2.307206918310372) -- (10,2.307206918310372);
\draw[line width=0.5pt, decoration=saw, decorate] (6.5,2.307206918310372)--(8.5,2.0834401019458575);
\draw [line width=0.5pt] (6.5,2.307206918310372)-- (6.434722732924095,1.7237668163645141);
\draw [line width=0.5pt] (6.434722732924095,1.7237668163645141)-- (8.434722732924094,1.5);
\draw [line width=0.5pt] (8.434722732924094,1.5)-- (8.5,2.0834401019458575);
\draw (7,2.2) node[anchor=north west,rotate=-5] {DG};
\draw (2.443632566538307,3.8902112526661) node[anchor=north west, rotate=-15] {Diode};
\draw [line width=0.5pt] (4.230879302730072,7.501565689507412)-- (4.677055650116055,7.033297954435219);
\draw [line width=0.5pt] (4.677055650116055,7.033297954435219)-- (2.8039847098272843,5.248592564891289);
\draw [line width=0.5pt] (2.8039847098272843,5.248592564891289)-- (2.357808362441301,5.716860299963483);
\draw [line width=0.5pt] (2.357808362441301,5.716860299963483)-- (4.230879302730072,7.501565689507412);
\draw [line width=0.5pt,color=ffqqqq] (6.5,2.307206918310372) -- (3.272252444899477,5.694768912277271);
\draw [line width=0.5pt,color=ffqqqq] (7.5,2.195323510128114) -- (3.7405201799716696,6.140945259663254);
\draw [line width=0.5pt,color=ffqqqq] (8.5,2.0834401019458575) -- (4.208787915043862,6.587121607049236);
\draw [line width=0.5pt] (2.6924406229807882,5.365659498659337)-- (2.469352449287797,5.599793366195435);
\draw [line width=0.5pt] (2.469352449287797,5.599793366195435)-- (0.3884559131535036,3.617066933768049);
\draw [line width=0.5pt] (0.3884559131535036,3.617066933768049)-- (0.6115440868464959,3.382933066231951);
\draw [line width=0.5pt] (0.6115440868464959,3.382933066231951)-- (2.6924406229807882,5.365659498659337);
\draw [line width=0.5pt] (3.06020996504959,6.386124821042456)-- (3.5284777001217824,6.8323011684284385);
\draw [line width=0.5pt] (3.5284777001217824,6.8323011684284385)-- (3.0823013527358,7.300568903500631);
\draw [line width=0.5pt] (3.0823013527358,7.300568903500631)-- (2.6140336176636074,6.854392556114648);
\draw [line width=0.5pt] (2.6140336176636074,6.854392556114648)-- (3.06020996504959,6.386124821042456);
\draw [line width=0.5pt] (2.7311005514316555,6.965936642961144)-- (2.9652344189677518,7.189024816654135);
\draw [line width=0.5pt] (2.9652344189677518,7.189024816654135)-- (2.7421462452747605,7.4231586841902315);
\draw [line width=0.5pt] (2.7421462452747605,7.4231586841902315)-- (2.5080123777386643,7.20007051049724);
\draw [line width=0.5pt] (2.5080123777386643,7.20007051049724)-- (2.7311005514316555,6.965936642961144);
\draw [line width=0.5pt] (2.273878510202568,6.976982336804249)-- (2.9762801128108567,7.646246857883223);
\draw [line width=0.5pt] (2.9762801128108567,7.646246857883223)-- (2.307015591731883,8.34864846049151);
\draw [line width=0.5pt] (2.307015591731883,8.34864846049151)-- (1.6046139891235942,7.679383939412538);
\draw [line width=0.5pt] (1.6046139891235942,7.679383939412538)-- (2.273878510202568,6.976982336804249);
\draw (4.7,2.6) node[anchor=north west] {Lens};
\draw (0.5,8.5) node[anchor=north west] {DC Motor};
\draw (4.4,7.6) node[anchor=north west] {Tuning Mirror};
\draw (1.5,3.1) node[anchor=north west,rotate=-15] {Temp. Control};
\draw (1.3,2.3) node[anchor=north west,rotate=-15] {Current Control};
\draw (2,6.6) node[anchor=north west] {PZT};
\draw (1.2,3.8) node[anchor=north west,rotate=-15] {HR};
\draw (3.8,3.1) node[anchor=north west,rotate=-15] {AR};
\draw [line width=2pt] (8.5,1.5)-- (9.5,2.5);
\draw [line width=0.5pt,color=ffqqqq] (9.083440101945857,2.083440101945857) -- (9.083440101945856,5);
\draw [line width=0.5pt,color=ffqqqq] (9.195323510128114,2.195323510128114) -- (9.195323510128114,5);
\draw [line width=0.5pt,color=ffqqqq] (9.307206918310373,2.307206918310372) -- (9.30720691831037,5);
\draw [line width=0.5pt] (8.695323510128114,5)-- (9.695323510128114,5);
\draw [line width=0.5pt] (9.695323510128114,5)-- (9.695323510128114,6);
\draw [line width=0.5pt] (9.695323510128114,6)-- (8.695323510128114,6);
\draw [line width=0.5pt] (8.695323510128114,6)-- (8.695323510128114,5);
\draw (7.5,6.5) node[anchor=north west] {Power Monitor};
\draw (8.8,2) node[anchor=north west] {Output};
\draw (0.1,0.8) node[anchor=north west] {Control Input};
\end{tikzpicture}
\end{document}

答案1

正如 Sigur 所建议的,最好的解决方案是将所有内容移至\definecolor...前导码,否则,它们会在您的 TikZ 图片前创建虚假空间。

或者,您可以在%每个 后面放置一个\definecolor...

确实,写作:

...
\definecolor{wrwrwr}{rgb}{0.3803921568627451,0.3803921568627451,0.3803921568627451}
\definecolor{ffqqqq}{rgb}{1,0,0}
\definecolor{qqffff}{rgb}{0,1,1}
\begin{tikzpicture}[line cap=round,line 
...

就像写:

...
\definecolor{wrwrwr}{rgb}{0.3803921568627451,0.3803921568627451,0.3803921568627451} \definecolor{ffqqqq}{rgb}{1,0,0} \definecolor{qqffff}{rgb}{0,1,1} \begin{tikzpicture}[line cap=round,line 
...

(请注意每个后面的空格\definecolor...),因为 TeX 将回车符解释为空格。

而写作:

...
\definecolor{wrwrwr}{rgb}{0.3803921568627451,0.3803921568627451,0.3803921568627451}%
\definecolor{ffqqqq}{rgb}{1,0,0}%
\definecolor{qqffff}{rgb}{0,1,1}%
\begin{tikzpicture}[line cap=round,line 
...

就像写:

...
\definecolor{wrwrwr}{rgb}{0.3803921568627451,0.3803921568627451,0.3803921568627451}\definecolor{ffqqqq}{rgb}{1,0,0}\definecolor{qqffff}{rgb}{0,1,1}\begin{tikzpicture}[line cap=round,line 
...

没有虚假的空间。

相关内容