我想tikz
按照以下方式修改所附的图片:
使
Import
、Tidy
、Model
、Communicate
为相同的文字和填充颜色。制作
Transform
Visualize
并“探索”另一个文本并填充颜色。
以下是tikz
生成图片的代码:
\documentclass[border=2mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text, fit}
\usetikzlibrary{positioning,fit,backgrounds,arrows.meta}
\begin{document}
\begin{tikzpicture}[scale=2, fatnode/.style={rectangle, draw=blue, rounded corners, fill=blue!20, minimum size=0.0mm}, font=\sf,>=Latex,thick]
\node[fatnode] (A) at (0, 0) {Import};
\node[fatnode] (B) at (1.2, 0) {Tidy};
\node[fatnode] (C) at (2.4, 0) {Transform};
\node[fatnode] (D) at (3.8, 0.8) {Visualize};
\node[fatnode] (E) at (3.8, -0.7) {Model};
\node[node] (F) at (4.3, 0) {};
\node[fatnode] (G) at (5.8, 0) {Communicate};
\draw [thick, ->] (A) -- (B) node[midway,above left,] {};
\draw [thick, ->] (B) -- (C) node[midway,above right] {};
\draw [thick, ->] (F) -- (G) node[midway,above left] {};
\draw [->,thick,postaction={decorate,decoration={raise=-2.5ex,text along path,text align=center,text={|\sffamily|}}}] (C) to [bend left=45] (D);
\draw [->,thick,postaction={decorate,decoration={raise=-2.5ex,text along path,text align=center,text={|\sffamily|}}}] (D) to [bend left=59] (E);
\draw [->,thick,postaction={decorate,decoration={raise=-2.5ex,text along path,text align=center,text={|\sffamily|}}}] (E) to [bend left=45] (C);
\begin{pgfonlayer}{background}
\node [fill=blue!10, dotted, rounded corners, fit= (C) (D) (E) (F)] (H) {}; % enough to add two diagonal nodes
\node[fill=white] at (H.south) {\footnotesize Explore};
\node[draw,, rounded corners, fit=(A) (B) (C) (D) (E) (F) (G) (H)] {};
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
我已经开始了旅程这里
答案1
你可以定义其他样式。在下面的代码中,fill=white
修改fill=red!20
from fatnode2
,因为它是最后一个。我删除了原始代码中无用的部分并使用相对定位。
\documentclass[border=2mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text, fit}
\usetikzlibrary{positioning,fit,backgrounds,arrows.meta}
\begin{document}
\begin{tikzpicture}[scale=2,
fatnode1/.style={rectangle, draw=blue, rounded corners, fill=blue!20, minimum size=0.0mm},
fatnode2/.style={rectangle, draw=red, rounded corners, fill=red!20, minimum size=0.0mm},
font=\sf,
>=Latex,
thick,
node distance=1.2]
\node[fatnode1] (A) at (0, 0) {Import};
\node[fatnode1, right=of A] (B) {Tidy};
\node[fatnode2, right=of B] (C) {Transform};
\node[fatnode2, above right=of C] (D) {Visualize};
\node[fatnode1, below right=of C] (E) {Model};
\node [xshift=1.2cm, right=of C] (F) {};
\begin{pgfonlayer}{background}
\node [fill=blue!10, rounded corners, fit= (C) (D) (E) (F)] (H) {}; % enough to add two diagonal nodes
\end{pgfonlayer}
\node[fatnode2, fill=white] (I) at (H.230) {\footnotesize Explore};
\node[fatnode1, right=of H] (G) {Communicate};
\draw [thick, ->] (A) -- (B);
\draw [thick, ->] (B) -- (C);
\draw [thick, ->] (H) -- (G);
\draw [->,thick] (C) to [bend left=45] (D);
\draw [->,thick] (D) to [bend left=59] (E);
\draw [->,thick] (E) to [bend left=45] (C);
\node[draw, rounded corners, fit=(A) (B) (C) (D) (E) (G) (H) (I)] {};
\end{tikzpicture}
\end{document}