tikz 绘制一个分区矩形

tikz 绘制一个分区矩形

我想画出下图,但我甚至不知道从哪里开始。这远远超出了我的 tikz 专业知识。如果有人能帮忙,我将不胜感激。以下是绘制矩形的骨架代码:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\node[rectangle,draw,minimum width=2in,minimum height=2in,thick,text width=2in] (box1) {Type-B adaptable\\Type-B adaptable\\Type-C robust\\Type-B adaptable\\Type-A robust\\Type-A adaptable\\Type-B adaptable\\Type-C adaptable};


\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

这是一个解决方案。曲线是通过

draw[] (A).. 控件 (B).. (C); draw[] (C) to[out=xx,in=yy] (E);

阴影线区域是通过环境clip技能完成的scope。此外,文本是通过 tikz 节点放置的。预定义了几种样式宏,包括黑白阴影。

在此处输入图片描述

代码

\documentclass[border=10pt]{standalone}%{article}
\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document}

\tikzset{rec/.style={thick,text width=2cm,font=\bfseries\large,align=left, text opacity=1},
line/.style={dashed, line width=2pt},
sharea/.style={shade, left color=gray!50, right color=white} % B/W shading
}
\begin{tikzpicture}[scale=1.5]
\path[sharea](-0.2,-0.2) rectangle (5.2,5.2);
\draw[line width=2pt] (0,0) rectangle (5,5);
% north west lines area
\fill[pattern=north west lines,opacity=0.2] (1.8,3.8) to [out=-120,in=90] (2.5,0)--(0,0)--(0,3); % blue line to the left
\fill[pattern=north west lines,opacity=0.2] (0,5)--(3.7,5).. controls (3,2.5) .. (0,1.5)-- cycle; % Yellow line to the left
\fill[white] (3,5) to[out=-135,in=15] (1.8,3.8) to [out=-200, in=35] (0,3.4) --(0,5)--(3,5); 
\path[sharea] (3,5) to[out=-135,in=15] (1.8,3.8) to [out=-200, in=35] (0,3.4) --(0,5)--(3,5); 
\begin{scope}
\path[clip] (1.8,3.8) to[out=-120,in=90](2.5,0)--(0,0)--(0,5)--(3,5)--cycle; 
\fill[white] (3.7,5).. controls (3,2.5) .. (0,1.5)-- (0,5); 
\path[sharea] (3.7,5).. controls (3,2.5) .. (0,1.5)-- (0,5);left
\end{scope}

%\path[draw] (0,0) grid (5,5);

\draw[line] (3,5) to[out=-135,in=15](1.8,3.8) to [out=-200, in=35] (0,3.4);
\draw[line] (1.8,3.8) to[out=-120,in=90](2.5,0);
\draw[line] (3.7,5).. controls (3,2.5) .. (0,1.5);
\draw[line] (5,2.5) to[out=-180,in=10] (2.6,2.6);
\draw[line] (4.2,2.5) to[out=-90,in=90] (4,0);
\draw[line] (4,1) to[out=160,in=0] (2.3,1);

% node to place text
\node[rec] at (1.2,0.8)           {Type-A, \\ robust};
\node[rec] at (2.5,3.3)           {Type-C, \\ robust};
\node[rec] at (3,1.8)             {Type-A, \\ adaptable};
\node[rec] at (1,4.5)             {Type-B, \\ adaptable};
\node[rec,rotate=40] at (0.8,2.5) {Type-B, \\ adaptable};
\node[rec,rotate=40] at (4.2,4)   {Type-B, \\ adaptable};
\node[rec] at (3.2,0.5)           {Type-B, \\ adaptable};
\node[rec,rotate=80] at (4.5,1)   {Type-C, \\ adaptable};
\end{tikzpicture}
\end{document}

相关内容