Tikz Fit 不适合我的节点

Tikz Fit 不适合我的节点

我正在制作一个有向无环图,我想突出显示一个子图。听起来很简单,但我无法使用 fit 选项完成它。我想突出显示节点 800 到 001 之间的整个区域。我正在从量子电路示例

梅威瑟:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,bending,backgrounds,fit}

\begin{document}
    \begin{figure}
            \begin{tikzpicture}[thick,scale=0.4, every node/.style={transform shape}, baseline=(current bounding box.north)]
            \node[draw,rectangle](start) {Start};
            \node[draw,circle,below=of start](100) {1,0,0};
            \node[draw,circle,gray,right=of 100](101) {1,0,1};
            \node[draw,circle,gray,right=of 101](110) {1,1,0};
            \node[draw,circle,gray,right=of 110](111) {1,1,1};
            \node[draw,circle,below=of 100](200) {2,0,0};   
            \node[draw,circle,gray,right=of 200](201) {2,0,1};      
            \node[draw,circle,gray,right=of 201](210) {2,1,0};      
            \node[draw,circle,gray,right=of 210](211) {2,1,1};      
            \node[draw,circle,below=of 200](300) {3,0,0};
            \node[draw,circle,gray,right=of 300](301) {3,0,1};
            \node[draw,circle,gray,right=of 301](310) {3,1,0};
            \node[draw,circle,gray,right=of 310](311) {3,1,1};
            \node[draw,circle,below=of 300](500) {5,0,0};
            \node[draw,circle,gray,right=of 500](501) {5,0,1};
            \node[draw,circle,gray,right=of 501](510) {5,1,0};
            \node[draw,circle,gray,right=of 510](511) {5,1,1};  
            \node[draw,circle,below=of 500](600) {6,0,0};
            \node[draw,circle,gray,right=of 600](601) {6,0,1};
            \node[draw,circle,gray,right=of 601](610) {6,1,0};
            \node[draw,circle,gray,right=of 610](611) {6,1,1};  
            \node[draw,circle,below=of 600](400) {4,0,0};
            \node[draw,circle,gray,right=of 400](401) {4,0,1};
            \node[draw,circle,gray,right=of 401](410) {4,1,0};
            \node[draw,circle,gray,right=of 410](411) {4,1,1};  
            \node[draw,circle,below=of 400](700) {7,0,0};
            \node[draw,circle,gray,right=of 700](701) {7,0,1};
            \node[draw,circle,gray,right=of 701](710) {7,1,0};
            \node[draw,circle,gray,right=of 710](711) {7,1,1};  
            \node[draw,circle,gray,below=of 700](800) {8,0,0};
            \node[draw,circle,right=of 800](801) {8,0,1};
            \node[draw,circle,gray,right=of 801](810) {8,1,0};
            \node[draw,circle,gray,right=of 810](811) {8,1,1};
            \node[draw,circle,gray,below=of 800](900) {9,0,0};
            \node[draw,circle,right=of 900](901) {9,0,1};
            \node[draw,circle,gray,right=of 901](910) {9,1,0};
            \node[draw,circle,gray,right=of 910](911) {9,1,1};
            \node[draw,circle,gray,below=of 900](1000) {10,0,0};
            \node[draw,circle,right=of 1000](1001) {10,0,1};
            \node[draw,circle,gray,right=of 1001](1010) {10,1,0};
            \node[draw,circle,gray,right=of 1010](1011) {10,1,1};   
            \node[draw,circle,gray,below=of 1000](1100) {11,0,0};
            \node[draw,circle,right=of 1100](1101) {11,0,1};
            \node[draw,circle,gray,right=of 1101](1110) {11,1,0};
            \node[draw,circle,gray,right=of 1110](1111) {11,1,1};   
            \node[draw,circle,gray,below=of 1100](1200) {12,0,0};
            \node[draw,circle,right=of 1200](1201) {12,0,1};
            \node[draw,circle,gray,right=of 1201](1210) {12,1,0};
            \node[draw,circle,gray,right=of 1210](1211) {12,1,1};
            \node[draw,circle,below=of 1200](1300) {13,0,0};
            \node[draw,circle,gray,right=of 1300](1301) {13,0,1};
            \node[draw,circle,right=of 1300](1301) {13,0,1};
            \node[draw,circle,gray,right=of 1301](1310) {13,1,0};
            \node[draw,circle,gray,right=of 1310](1311) {13,1,1};
            \node[draw,circle,gray,below=of 1300](1400) {14,0,0};
            \node[draw,circle,right=of 1400](1401) {14,0,1};
            \node[draw,circle,gray,right=of 1401](1410) {14,1,0};
            \node[draw,circle,gray,right=of 1410](1411) {14,1,1};   
            \node[draw,circle,gray,below=of 1400](1500) {15,0,0};
            \node[draw,circle,right=of 1500](1501) {15,0,1};
            \node[draw,circle,gray,right=of 1501](1510) {15,1,0};
            \node[draw,circle,gray,right=of 1510](1511) {15,1,1};   
            \node[draw,circle,gray,below=of 1500](1600) {16,0,0};
            \node[draw,circle,right=of 1600](1601) {16,0,1};
            \node[draw,circle,gray,right=of 1601](1610) {16,1,0};
            \node[draw,circle,gray,right=of 1610](1611) {16,1,1};
            \node[draw,circle,gray,below=of 1600](1700) {17,0,0};
            \node[draw,circle,right=of 1700](1701) {17,0,1};
            \node[draw,circle,gray,right=of 1701](1710) {17,1,0};
            \node[draw,circle,gray,right=of 1710](1711) {17,1,1};
            \node[draw,circle,gray,below=of 1700](1800) {18,0,0};
            \node[draw,circle,right=of 1800](1801) {18,0,1};
            \node[draw,circle,gray,right=of 1801](1810) {18,1,0};
            \node[draw,circle,gray,right=of 1810](1811) {18,1,1};   
            \node[draw,circle,gray,below=of 1800](1900) {19,0,0};
            \node[draw,circle,right=of 1900](1901) {19,0,1};
            \node[draw,circle,gray,right=of 1901](1910) {19,1,0};
            \node[draw,circle,gray,right=of 1910](1911) {19,1,1};   
            \node[draw,circle,gray,below=of 1900](2000) {20,0,0};
            \node[draw,circle,right=of 2000](2001) {20,0,1};
            \node[draw,circle,gray,right=of 2001](2010) {20,1,0};
            \node[draw,circle,gray,right=of 2010](2011) {20,1,1};   
            \node[draw,circle,gray,below=of 2000](000) {0,0,0};
            \node[draw,circle,right=of 000](001) {0,0,1};
            \node[draw,circle,gray,right=of 001](010) {0,1,0};
            \node[draw,circle,gray,right=of 010](011) {0,1,1};
            \node[draw,rectangle,below=of 001](end) {end};

            \draw [->,thick] (700) to [bend right=11] (end);
            \draw [->,thick] (001) -- (end);
            \draw [->,thick] (start) -- (100);
            \draw [->,thick] (100) -- (200);
            \draw [->,thick] (200) -- (300);
            \draw [->,thick] (300) -- (500);
            \draw [->,thick,dashed] (600.west) to [bend left] node [midway,sloped,above=1pt]{cb} (500.west) ;
            \draw [->,thick] (600) -- (400);
            \draw [->,thick] (400) -- (700);
            \draw [->,thick] (400) --  node[midway,sloped,above=1pt] {grant} (801) ;
            \draw [->,thick] (801) -- (901);
            \draw [->,thick] (901) -- (1001);
            \draw [->,thick] (1001) -- (1101);
            \draw [->,thick] (1101) to [bend right=15] (001);
            \draw [->,thick] (1001) to [bend left] (1201);
            \draw [->,thick] (1201) -- (1301);
            \draw [->,thick] (1301) -- (1401);
            \draw [->,thick] (1401) -- (1501);
            \draw [->,thick] (1501) -- (1601);
            \draw [->,thick,dashed] (1701.west) to [bend left] node [midway,sloped,above=1pt]{cb} (1601.west) ;
            \draw [->,thick] (1701) -- (1801);
            \draw [->,thick] (1801) -- (1901);
            \draw [->,thick,dashed] (2001.west) to [bend left] node [midway,sloped,above=1pt]{cb} (1901.west) ;
            \draw [->,thick] (2001) -- (001);


            \tikzstyle{surround} = [fill=blue!10,thick,draw=black,rounded corners=2mm]
            \begin{pgfonlayer}{background} 
            %This is not working well
            \node[surround] (background) [fit = (800) (011) ] {};
            \end{pgfonlayer}

            \end{tikzpicture}


    \end{figure}
\end{document}

这是输出。矩形太小了。

在此处输入图片描述

答案1

指定范围内的比例就足够了,而不必指定整个图纸。

在范围内精确限定梯级的不足并不会影响整个设计。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,bending,backgrounds,fit}

\begin{document}
    \begin{figure}
            \begin{tikzpicture}

            \begin{scope}[thick,scale=0.4, every node/.style={transform shape}, baseline=(current bounding box.north)]
            \node[draw,rectangle](start) {Start};
            \node[draw,circle,below=of start](100) {1,0,0};
            \node[draw,circle,gray,right=of 100](101) {1,0,1};
            \node[draw,circle,gray,right=of 101](110) {1,1,0};
            \node[draw,circle,gray,right=of 110](111) {1,1,1};
            \node[draw,circle,below=of 100](200) {2,0,0};   
            \node[draw,circle,gray,right=of 200](201) {2,0,1};      
            \node[draw,circle,gray,right=of 201](210) {2,1,0};      
            \node[draw,circle,gray,right=of 210](211) {2,1,1};      
            \node[draw,circle,below=of 200](300) {3,0,0};
            \node[draw,circle,gray,right=of 300](301) {3,0,1};
            \node[draw,circle,gray,right=of 301](310) {3,1,0};
            \node[draw,circle,gray,right=of 310](311) {3,1,1};
            \node[draw,circle,below=of 300](500) {5,0,0};
            \node[draw,circle,gray,right=of 500](501) {5,0,1};
            \node[draw,circle,gray,right=of 501](510) {5,1,0};
            \node[draw,circle,gray,right=of 510](511) {5,1,1};  
            \node[draw,circle,below=of 500](600) {6,0,0};
            \node[draw,circle,gray,right=of 600](601) {6,0,1};
            \node[draw,circle,gray,right=of 601](610) {6,1,0};
            \node[draw,circle,gray,right=of 610](611) {6,1,1};  
            \node[draw,circle,below=of 600](400) {4,0,0};
            \node[draw,circle,gray,right=of 400](401) {4,0,1};
            \node[draw,circle,gray,right=of 401](410) {4,1,0};
            \node[draw,circle,gray,right=of 410](411) {4,1,1};  
            \node[draw,circle,below=of 400](700) {7,0,0};
            \node[draw,circle,gray,right=of 700](701) {7,0,1};
            \node[draw,circle,gray,right=of 701](710) {7,1,0};
            \node[draw,circle,gray,right=of 710](711) {7,1,1};  
            \node[draw,circle,gray,below=of 700](800) {8,0,0};
            \node[draw,circle,right=of 800](801) {8,0,1};
            \node[draw,circle,gray,right=of 801](810) {8,1,0};
            \node[draw,circle,gray,right=of 810](811) {8,1,1};
            \node[draw,circle,gray,below=of 800](900) {9,0,0};
            \node[draw,circle,right=of 900](901) {9,0,1};
            \node[draw,circle,gray,right=of 901](910) {9,1,0};
            \node[draw,circle,gray,right=of 910](911) {9,1,1};
            \node[draw,circle,gray,below=of 900](1000) {10,0,0};
            \node[draw,circle,right=of 1000](1001) {10,0,1};
            \node[draw,circle,gray,right=of 1001](1010) {10,1,0};
            \node[draw,circle,gray,right=of 1010](1011) {10,1,1};   
            \node[draw,circle,gray,below=of 1000](1100) {11,0,0};
            \node[draw,circle,right=of 1100](1101) {11,0,1};
            \node[draw,circle,gray,right=of 1101](1110) {11,1,0};
            \node[draw,circle,gray,right=of 1110](1111) {11,1,1};   
            \node[draw,circle,gray,below=of 1100](1200) {12,0,0};
            \node[draw,circle,right=of 1200](1201) {12,0,1};
            \node[draw,circle,gray,right=of 1201](1210) {12,1,0};
            \node[draw,circle,gray,right=of 1210](1211) {12,1,1};
            \node[draw,circle,below=of 1200](1300) {13,0,0};
            \node[draw,circle,gray,right=of 1300](1301) {13,0,1};
            \node[draw,circle,right=of 1300](1301) {13,0,1};
            \node[draw,circle,gray,right=of 1301](1310) {13,1,0};
            \node[draw,circle,gray,right=of 1310](1311) {13,1,1};
            \node[draw,circle,gray,below=of 1300](1400) {14,0,0};
            \node[draw,circle,right=of 1400](1401) {14,0,1};
            \node[draw,circle,gray,right=of 1401](1410) {14,1,0};
            \node[draw,circle,gray,right=of 1410](1411) {14,1,1};   
            \node[draw,circle,gray,below=of 1400](1500) {15,0,0};
            \node[draw,circle,right=of 1500](1501) {15,0,1};
            \node[draw,circle,gray,right=of 1501](1510) {15,1,0};
            \node[draw,circle,gray,right=of 1510](1511) {15,1,1};   
            \node[draw,circle,gray,below=of 1500](1600) {16,0,0};
            \node[draw,circle,right=of 1600](1601) {16,0,1};
            \node[draw,circle,gray,right=of 1601](1610) {16,1,0};
            \node[draw,circle,gray,right=of 1610](1611) {16,1,1};
            \node[draw,circle,gray,below=of 1600](1700) {17,0,0};
            \node[draw,circle,right=of 1700](1701) {17,0,1};
            \node[draw,circle,gray,right=of 1701](1710) {17,1,0};
            \node[draw,circle,gray,right=of 1710](1711) {17,1,1};
            \node[draw,circle,gray,below=of 1700](1800) {18,0,0};
            \node[draw,circle,right=of 1800](1801) {18,0,1};
            \node[draw,circle,gray,right=of 1801](1810) {18,1,0};
            \node[draw,circle,gray,right=of 1810](1811) {18,1,1};   
            \node[draw,circle,gray,below=of 1800](1900) {19,0,0};
            \node[draw,circle,right=of 1900](1901) {19,0,1};
            \node[draw,circle,gray,right=of 1901](1910) {19,1,0};
            \node[draw,circle,gray,right=of 1910](1911) {19,1,1};   
            \node[draw,circle,gray,below=of 1900](2000) {20,0,0};
            \node[draw,circle,right=of 2000](2001) {20,0,1};
            \node[draw,circle,gray,right=of 2001](2010) {20,1,0};
            \node[draw,circle,gray,right=of 2010](2011) {20,1,1};   
            \node[draw,circle,gray,below=of 2000](000) {0,0,0};
            \node[draw,circle,right=of 000](001) {0,0,1};
            \node[draw,circle,gray,right=of 001](010) {0,1,0};
            \node[draw,circle,gray,right=of 010](011) {0,1,1};
            \node[draw,rectangle,below=of 001](end) {end};

            \draw [->,thick] (700) to [bend right=11] (end);
            \draw [->,thick] (001) -- (end);
            \draw [->,thick] (start) -- (100);
            \draw [->,thick] (100) -- (200);
            \draw [->,thick] (200) -- (300);
            \draw [->,thick] (300) -- (500);
            \draw [->,thick,dashed] (600.west) to [bend left] node [midway,sloped,above=1pt]{cb} (500.west) ;
            \draw [->,thick] (600) -- (400);
            \draw [->,thick] (400) -- (700);
            \draw [->,thick] (400) --  node[midway,sloped,above=1pt] {grant} (801) ;
            \draw [->,thick] (801) -- (901);
            \draw [->,thick] (901) -- (1001);
            \draw [->,thick] (1001) -- (1101);
            \draw [->,thick] (1101) to [bend right=15] (001);
            \draw [->,thick] (1001) to [bend left] (1201);
            \draw [->,thick] (1201) -- (1301);
            \draw [->,thick] (1301) -- (1401);
            \draw [->,thick] (1401) -- (1501);
            \draw [->,thick] (1501) -- (1601);
            \draw [->,thick,dashed] (1701.west) to [bend left] node [midway,sloped,above=1pt]{cb} (1601.west) ;
            \draw [->,thick] (1701) -- (1801);
            \draw [->,thick] (1801) -- (1901);
            \draw [->,thick,dashed] (2001.west) to [bend left] node [midway,sloped,above=1pt]{cb} (1901.west) ;
            \draw [->,thick] (2001) -- (001);
            \end{scope}


            \tikzstyle{surround} = [fill=blue!10,thick,draw=black,rounded corners=2mm]
            \begin{pgfonlayer}{background} 
            %This is not working well
            \node[surround] (background) [fit = (800) (011) ] {};
            \end{pgfonlayer}

            \end{tikzpicture}


    \end{figure}
\end{document}

在此处输入图片描述

在我看来,这种功能适合应该被修改,并恢复它在以前版本的tikz的功能,但作者肯定他们的理由

我似乎认为该功能已修改,并恢复了 tikz 先前版本中的功能,但作者确保了他们的理由

答案2

scale=0.4问题是由于在 -environment的选项中使用了 而引起的tikzpicture。如果使用scale=1拟合面积 则是正确的。

为了解决这个问题,您可以scale=2.5为背景设置 (= 1/0.4)。

注意:我还包括了节点(1011),因为否则中间状态就不会完全封闭。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,bending,backgrounds,fit}

\begin{document}
    \begin{figure}
        \begin{tikzpicture}[thick,scale=0.4, every node/.style={transform shape}, baseline=(current bounding box.north)]
            \node[draw,rectangle](start) {Start};
            \node[draw,circle,below=of start](100) {1,0,0};
            \node[draw,circle,gray,right=of 100](101) {1,0,1};
            \node[draw,circle,gray,right=of 101](110) {1,1,0};
            \node[draw,circle,gray,right=of 110](111) {1,1,1};
            \node[draw,circle,below=of 100](200) {2,0,0};   
            \node[draw,circle,gray,right=of 200](201) {2,0,1};      
            \node[draw,circle,gray,right=of 201](210) {2,1,0};      
            \node[draw,circle,gray,right=of 210](211) {2,1,1};      
            \node[draw,circle,below=of 200](300) {3,0,0};
            \node[draw,circle,gray,right=of 300](301) {3,0,1};
            \node[draw,circle,gray,right=of 301](310) {3,1,0};
            \node[draw,circle,gray,right=of 310](311) {3,1,1};
            \node[draw,circle,below=of 300](500) {5,0,0};
            \node[draw,circle,gray,right=of 500](501) {5,0,1};
            \node[draw,circle,gray,right=of 501](510) {5,1,0};
            \node[draw,circle,gray,right=of 510](511) {5,1,1};  
            \node[draw,circle,below=of 500](600) {6,0,0};
            \node[draw,circle,gray,right=of 600](601) {6,0,1};
            \node[draw,circle,gray,right=of 601](610) {6,1,0};
            \node[draw,circle,gray,right=of 610](611) {6,1,1};  
            \node[draw,circle,below=of 600](400) {4,0,0};
            \node[draw,circle,gray,right=of 400](401) {4,0,1};
            \node[draw,circle,gray,right=of 401](410) {4,1,0};
            \node[draw,circle,gray,right=of 410](411) {4,1,1};  
            \node[draw,circle,below=of 400](700) {7,0,0};
            \node[draw,circle,gray,right=of 700](701) {7,0,1};
            \node[draw,circle,gray,right=of 701](710) {7,1,0};
            \node[draw,circle,gray,right=of 710](711) {7,1,1};  
            \node[draw,circle,gray,below=of 700](800) {8,0,0};
            \node[draw,circle,right=of 800](801) {8,0,1};
            \node[draw,circle,gray,right=of 801](810) {8,1,0};
            \node[draw,circle,gray,right=of 810](811) {8,1,1};
            \node[draw,circle,gray,below=of 800](900) {9,0,0};
            \node[draw,circle,right=of 900](901) {9,0,1};
            \node[draw,circle,gray,right=of 901](910) {9,1,0};
            \node[draw,circle,gray,right=of 910](911) {9,1,1};
            \node[draw,circle,gray,below=of 900](1000) {10,0,0};
            \node[draw,circle,right=of 1000](1001) {10,0,1};
            \node[draw,circle,gray,right=of 1001](1010) {10,1,0};
            \node[draw,circle,gray,right=of 1010](1011) {10,1,1};   
            \node[draw,circle,gray,below=of 1000](1100) {11,0,0};
            \node[draw,circle,right=of 1100](1101) {11,0,1};
            \node[draw,circle,gray,right=of 1101](1110) {11,1,0};
            \node[draw,circle,gray,right=of 1110](1111) {11,1,1};   
            \node[draw,circle,gray,below=of 1100](1200) {12,0,0};
            \node[draw,circle,right=of 1200](1201) {12,0,1};
            \node[draw,circle,gray,right=of 1201](1210) {12,1,0};
            \node[draw,circle,gray,right=of 1210](1211) {12,1,1};
            \node[draw,circle,below=of 1200](1300) {13,0,0};
            \node[draw,circle,gray,right=of 1300](1301) {13,0,1};
            \node[draw,circle,right=of 1300](1301) {13,0,1};
            \node[draw,circle,gray,right=of 1301](1310) {13,1,0};
            \node[draw,circle,gray,right=of 1310](1311) {13,1,1};
            \node[draw,circle,gray,below=of 1300](1400) {14,0,0};
            \node[draw,circle,right=of 1400](1401) {14,0,1};
            \node[draw,circle,gray,right=of 1401](1410) {14,1,0};
            \node[draw,circle,gray,right=of 1410](1411) {14,1,1};   
            \node[draw,circle,gray,below=of 1400](1500) {15,0,0};
            \node[draw,circle,right=of 1500](1501) {15,0,1};
            \node[draw,circle,gray,right=of 1501](1510) {15,1,0};
            \node[draw,circle,gray,right=of 1510](1511) {15,1,1};   
            \node[draw,circle,gray,below=of 1500](1600) {16,0,0};
            \node[draw,circle,right=of 1600](1601) {16,0,1};
            \node[draw,circle,gray,right=of 1601](1610) {16,1,0};
            \node[draw,circle,gray,right=of 1610](1611) {16,1,1};
            \node[draw,circle,gray,below=of 1600](1700) {17,0,0};
            \node[draw,circle,right=of 1700](1701) {17,0,1};
            \node[draw,circle,gray,right=of 1701](1710) {17,1,0};
            \node[draw,circle,gray,right=of 1710](1711) {17,1,1};
            \node[draw,circle,gray,below=of 1700](1800) {18,0,0};
            \node[draw,circle,right=of 1800](1801) {18,0,1};
            \node[draw,circle,gray,right=of 1801](1810) {18,1,0};
            \node[draw,circle,gray,right=of 1810](1811) {18,1,1};   
            \node[draw,circle,gray,below=of 1800](1900) {19,0,0};
            \node[draw,circle,right=of 1900](1901) {19,0,1};
            \node[draw,circle,gray,right=of 1901](1910) {19,1,0};
            \node[draw,circle,gray,right=of 1910](1911) {19,1,1};   
            \node[draw,circle,gray,below=of 1900](2000) {20,0,0};
            \node[draw,circle,right=of 2000](2001) {20,0,1};
            \node[draw,circle,gray,right=of 2001](2010) {20,1,0};
            \node[draw,circle,gray,right=of 2010](2011) {20,1,1};   
            \node[draw,circle,gray,below=of 2000](000) {0,0,0};
            \node[draw,circle,right=of 000](001) {0,0,1};
            \node[draw,circle,gray,right=of 001](010) {0,1,0};
            \node[draw,circle,gray,right=of 010](011) {0,1,1};
            \node[draw,rectangle,below=of 001](end) {end};

            \draw [->,thick] (700) to [bend right=11] (end);
            \draw [->,thick] (001) -- (end);
            \draw [->,thick] (start) -- (100);
            \draw [->,thick] (100) -- (200);
            \draw [->,thick] (200) -- (300);
            \draw [->,thick] (300) -- (500);
            \draw [->,thick,dashed] (600.west) to [bend left] node [midway,sloped,above=1pt]{cb} (500.west) ;
            \draw [->,thick] (600) -- (400);
            \draw [->,thick] (400) -- (700);
            \draw [->,thick] (400) --  node[midway,sloped,above=1pt] {grant} (801) ;
            \draw [->,thick] (801) -- (901);
            \draw [->,thick] (901) -- (1001);
            \draw [->,thick] (1001) -- (1101);
            \draw [->,thick] (1101) to [bend right=15] (001);
            \draw [->,thick] (1001) to [bend left] (1201);
            \draw [->,thick] (1201) -- (1301);
            \draw [->,thick] (1301) -- (1401);
            \draw [->,thick] (1401) -- (1501);
            \draw [->,thick] (1501) -- (1601);
            \draw [->,thick,dashed] (1701.west) to [bend left] node [midway,sloped,above=1pt]{cb} (1601.west) ;
            \draw [->,thick] (1701) -- (1801);
            \draw [->,thick] (1801) -- (1901);
            \draw [->,thick,dashed] (2001.west) to [bend left] node [midway,sloped,above=1pt]{cb} (1901.west) ;
            \draw [->,thick] (2001) -- (001);

            \tikzstyle{surround} = [fill=blue!10,thick,draw=black,rounded corners=2mm]
            \begin{pgfonlayer}{background} 
                %This is working well with: scale = 1 / 0.4 = 2.5
                \node[surround, scale=2.5] (background) [fit = (800) (011) (1011) ] {};
            \end{pgfonlayer}
        \end{tikzpicture}
    \end{figure}
\end{document}

在此处输入图片描述

相关内容