我想让我的图表的矩形看起来像这样,箭头和矩形以粗体显示,并且具有阴影效果:
现在它们看起来是这样的:
\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
forked edges,
for tree={draw,align=center,edge={-latex}}
[Recommendation\\ Systems
[1.1]
[1.2
[1.2.1
[1.2.1.1]
[1.2.1.2]
]
[1.2.2
[1.2.2.1]
[1.2.2.2]
[1.2.2.3]
]
]
[1.3]
]
\end{forest}
\end{document}
答案1
怎么样
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta,bending,shadows.blur,shapes.multipart,
shapes.geometric,calc}
\tikzset{database/.style={cylinder,aspect=0.3,draw,shape border rotate=90,path picture={
\draw let \p1=($(path picture bounding box.east)-(path picture bounding
box.west)$) in
foreach \XX in {1,2,3} {([yshift=-0.15*\x1-\XX*1ex]path picture bounding box.north west)
arc(180:360:\x1/2 and 0.3*\x1/2)};
}}}
\newsavebox\LoopArrow
\sbox\LoopArrow{\begin{tikzpicture}
\draw[thick,-{Latex[bend]}] (90:2em) arc(90:455:2em);
\end{tikzpicture}}
\begin{document}
\begin{tikzpicture}[font=\sffamily,
grimsel/.style={rectangle split,rectangle split parts=2,draw,thick,
fill=white,blur shadow,rounded corners,text width=10em,align=center}]
\node[grimsel] (datap) {Data preprocessing\nodepart[align=left]{two}
\textit{blablabla.py}\\
xyz\\
abc};
\node[grimsel,below=3em of datap] (fine) {Finetuning\nodepart[align=left]{two}
\textit{blablabla.py}\\
\makebox[10em][c]{\usebox\LoopArrow}};
\node[grimsel,above right=2em and 4em of fine.east] (algo) {Algorithms\nodepart[align=left]{two}
\textit{blablabla.py}\\
xyz\\
abc};
\node[grimsel,below right=2em and 4em of fine.east] (utils) {Utils\nodepart[align=left]{two}
Evaluation\\
abc\\
xyz\\
abc};
\node[left=3em of datap,thick,fill=white,blur shadow,database,shape aspect=0.3,minimum height=8em] (SQL) {PostGreSQL};
\begin{scope}[very thick,-Latex]
\draw (SQL) -- (datap);
\draw (datap) -- (fine);
\draw (algo.west) -- ++ (-2em,0) |- (fine);
\draw (utils.west) -- ++ (-2em,0) |- (fine);
\end{scope}
\end{tikzpicture}
\end{document}
或者森林版本:
\documentclass{article}
\usepackage[edges]{forest}
\usetikzlibrary{shadows.blur,shapes.multipart}
\tikzset{grimsel/.style={rectangle split,rectangle split parts=2,draw,
fill=white,blur shadow,rounded corners,align=center}}
\begin{document}
\newcommand{\NodeTitle}[2][]{#2\nodepart[align=left,text width={width("#2")}]{two}}
\begin{forest}
forked edges,
for tree={grimsel,edge={-latex}}
[{\NodeTitle{Recommendation Systems} bla bla}
[{\NodeTitle{1.1} bla}]
[{\NodeTitle{1.2} bla}
[{\NodeTitle{1.2.1} bla}
[{\NodeTitle{1.2.1.1} bla}]
[{\NodeTitle{1.2.1.2} bla}]
]
[{\NodeTitle{1.2.2} bla}
[{\NodeTitle{1.2.2.1} bla}]
[{\NodeTitle{1.2.2.2} bla}]
[{\NodeTitle{1.2.2.3} bla}]
]
]
[{1.3\nodepart[align=left]{two} bla}]
]
\end{forest}
\end{document}