我试图在乳胶中绘制流程图,迷你图表比矩形大。我如何调整外部矩形以容纳其中的所有内容。是否也可以旋转图表中的文本。到目前为止我的代码。
\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{figure}[ht]
\begin{center}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=2.0cm,y=2.0cm]
\clip(-0.99,-0.98) rectangle (17.6,7.6);
\draw (3,1.5)-- (4.5,1.5); %stom top
\draw (2.5,2.5)-- (2.5,2); %left side liver
\draw (2.5,2.5)-- (5,2.5); %Liver top
\draw (5,2.5)-- (5,2); %right side liver
\draw (5,2)-- (2.5,2); %liver bottom
\draw (3,1.5)-- (3,0.5); %stom side left
\draw (4.5,1.5)-- (4.5,0.5); %stom side right
\draw (4.5,0.5)-- (3,0.5); % stom bottom
\draw [->] (2.71,1.26) -- (3.05,1.26); %stomuch to gut
\draw (2.71,1.26)-- (2.71,2); %liver to gut
\draw (4.5,1.22)-- (4.8,1.22); %gut to liver
\draw [->] (4.81,1.22) -- (4.81,2);
\draw (3,3.5)-- (3,3); %spleen side left
\draw (3,3.5)-- (4.5,3.5); % spleen top
\draw (4.5,3.5)-- (4.5,3); % spleen side right
\draw (3,3)-- (4.5,3); % spleen bottom
\draw (4.5,3.28)-- (4.76,3.28); %spleen to liver
\draw [->] (4.77,3.28) -- (4.77,2.5);
\draw (2.5,4.5)-- (2.5,4); %muscle left side
% \draw (2.5,4)-- (2.5,4.5);
\draw (2.5,4.5)-- (5,4.5); %muscle top
\draw (5,4.5)-- (5,4); %muscle right side
\draw (5,4)-- (2.5,4); % muscle bottom
\draw (2.5,-0.5)-- (2.5,0); %bone left side
\draw (2.5,0)-- (5,0); %bone top
\draw (5,0)-- (5,-0.5); %bone right side
\draw (2.5,-0.5)-- (5.0,-0.5); %bone bottom
%%%
\draw (2.5,-0.85)-- (5.0,-0.85); %kidney bottom
\draw (2.5,-0.98)-- (5.5,-0.95); %bone top
%\draw (5,0)-- (5,-0.5); %bone right side
%\draw (2.5,-0.5)-- (5.0,-0.5); %bone bottom
\draw(2.5,5.5)--(5,5.5); %fat top
\draw(5.0,5.5) --(5,5.0); % fat right side
\draw(2.5, 5.5) --(2.5,5.0); % fat left side
\draw(2.5,5.0)--(5.0,5.0); % fat bottom
\draw(2.5,6.0)--(5.0,6.0); % brain bottom
\draw(5.0,6.5)--(5.0,6.0); % brain right side
\draw(2.5,6.0)--(2.5,6.5); % brain left side
\draw(2.5,6.5)--(5.0,6.5); % brain bottom
\draw (1,15.5)-- (1,-7.5); %side
\draw (1,-0.98)-- (1.5,-0.98); %bottom
\draw (1.5,-13.5)-- (1.5,13.5);
\draw (1.5,17.3)-- (1.5,17.3); %top
\draw (6,13.5)-- (6,-9.5); %side left
\draw (6,-0.98)-- (6.5,-0.98);
\draw (6.5,-15.5)-- (6.5,15.5); %side bottom
\draw (6,16.5)-- (6.5,16.5); rectabgle top
\draw (-0.5,1)-- (0.5,1); %stomu
\draw (0.5,1)-- (0.5,0.5);
\draw (0.5,0.5)-- (-0.5,0.5);
\draw (-0.5,0.5)-- (-0.5,1); stomu
\draw [->] (0.5,0.76) -- (2.94,0.76);
\draw [->] (4.5,0.86) -- (7.07,0.86);
\draw [->] (0,1.5) -- (0,1);
\draw (0.65,2.07) node[anchor=north west] {\textbf{Artertial blood}};
\draw (3.51,4.31) node[anchor=north west] {muscle};
\draw (3.49,3.31) node[anchor=north west] {Spleen};
\draw (3.56,2.39) node[anchor=north west] {Liver};
\draw (3.65,1.05) node[anchor=north west] {Gut};
\draw (3.57,-0.17) node[anchor=north west] {Bone};
\draw (-0.18,0.8) node[anchor=north west] {Stomach};
\draw (-0.14,1.76) node[anchor=north west] {Dose};
\draw (7.12,0.94) node[anchor=north west] {elimination};
\draw (5.81,3.16) node[anchor=north west] {\textbf{Venous blood}};
\draw [->] (5,2.23) -- (6,2.23);
\draw [->] (5,4.3) -- (6,4.3);
\draw [->] (1.5,4.24) -- (2.5,4.24);
\draw [->] (5.0,-0.30) -- (6,-0.30);
\draw [->] (1.5,-0.24) -- (2.5,-0.24);
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
答案1
到目前为止,我能够从您的代码中重建以下内容(考虑到图表所显示的可见部分):
\documentclass[10pt, margin=3mm]{standalone}% {article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
positioning,
shapes.multipart}
\pgfdeclarelayer{foreground}
\pgfdeclarelayer{background}
\pgfsetlayers{background,%
main,%
foreground%
}
\begin{document}
% \begin{figure}[ht]
% \centering
\begin{tikzpicture}[
> = {Triangle[angle=60:2pt 3]},
node distance = 1mm and 11mm,
start chain = A going below,
box/.style = {draw=gray, semithick, fill=gray!30,
minimum height=5mm, minimum width=#1,
on chain=A},
box/.default = 16mm,
mpn/.style = {draw=gray, semithick, fill=gray!30,
rectangle split, rectangle split parts=2,
rectangle split draw splits=false,
minimum width=9mm,
on chain=A,
append after command={\pgfextra{\let\LN\tikzlastnode
\begin{pgfonlayer}{foreground}
\draw[dashed, thin]
(\LN.one split west) -- (\LN.one split east);
\end{pgfonlayer}
}}
},
jump/.pic = {\draw[line cap=rect] (.06,0) coordinate (-out)
arc (0:180:0.06) coordinate (-in);
},
]
\node[box] {Lung}; % A-1
\node[box] {Brain};
\node[box] {Fat};
\node[box] {Muscle};
\node[box=9mm] {Spleen};
\node[box] {Liver};
\node[mpn] {Gut\nodepart{two}}; % A-7
\node[box] {Bone};
\node[box] {Kidney};
\node[box] {Skin};
\node[box] {Heart};
\node[box] {Carcas}; % A-12
%
\node[align=center, font=\bfseries,
left =of A-5] {Arterial\\ Blood};
\node[align=center, font=\bfseries,
right=of A-5] {Venous\\ Blood};
% stomach-gut-liver
\node[box, left=of A-7.one west] {Stomach}; % A-13
\node (A-14) [align=center,left=of A-13] {Oral\\ dosing};
\draw[->] (A-14) -- (A-13);
\draw[->] ([xshift=1mm] A-6.south west) coordinate (jmp1) % NEW
|- (A-7.two west);
\draw[->] (A-7.one east) -| ([xshift=-1mm] A-6.south east);
% spleen -- liver
\draw[->] (A-5) -| ([xshift=-1mm] A-6.north east);
% left connecting lines
\draw[->] (A-1.west) -- ++ (-.5,0) coordinate (aux-1)
|- (A-12);
\foreach \i in {2,...,6,8,9,...,12}
\draw[->] (aux-1 |- A-\i) -- (A-\i);
% input line with jumps over lines NEW
\path (aux-1 |- A-7.one west) pic (jmp2) {jump};
\path (jmp1 |- A-7.one west) pic (jmp3) {jump};
% from kidney -- to east
\draw[->] (A-13) -- (jmp2-in)
(jmp2-out) -- (jmp3-in)
(jmp3-out) -- (A-7.one west);
% right connecting lines
\draw (A-12.east) -- ++ (.5,0) coordinate (aux-2)
|- (A-1);
\foreach \i in {2,...,4,6,9,10,11}
\draw[->] (A-\i) -- (aux-2 |- A-\i);
% output lines with jumps over lines NEW
% from Gut
\path (aux-2 |- A-7.two east) pic (jmp4) {jump};
\draw[->] (A-7.two east) -- (jmp4-in)
(jmp4-out) -- ++ (1.5,0);
% from kidney -- to east
\path ([yshift=-1.5mm] aux-2 |- A.east) pic (jmp5) {jump};;
\draw[->] ([yshift=-1.5mm] A-9.east) -- (jmp5-in)
(jmp5-out) -- ++ (1,0);
\end{tikzpicture}
% `\end{figure}
\end{document}
编辑:添加缺少的输出线和线交叉点处的轨迹