我需要一些专家的建议来帮助我开始这个图表:
来自我的一个旧帖子:
\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}
答案1
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning,fit,shadows.blur,shapes.geometric,calc}
\begin{document}
\begin{tikzpicture}[font=\sffamily,
regentonne/.style={cylinder,aspect=0.3,draw,shape border rotate=90}]
\begin{scope}[nodes={align=center,fill=white,blur shadow}]
\node[regentonne] (A) {MovieLens\\ Database};
\node[regentonne,right=10em of A] (B) {MovieLens\\ Features};
\path (A) -- (B) node[midway,above=9em,regentonne] (C) {User--Item\\ Pairs};
\node[anchor=north west,draw,minimum width=8em] at (B.west|-C.north) (D) {Collaborative\\
Filter\\ Algorithms\\[2em]SVD\\ KNN};
\path let \p1=($(D.south)-(B.north)$) in node[anchor=north west,draw,minimum width=8em] at
([yshift=-\y1]B.south-|D.west) (E) {Error Prediction\\ Models\\[2em]
SVD\\ KNN};
\node[right=5em of E,draw] (F) {Algorithm\\ Selection};
\node[below=5em of F,draw] (G) {Predicted Rating};
\begin{scope}[>=stealth,thick,->]
\draw[rounded corners] (A) -| (C);
\draw[rounded corners] (D.-10) -| (F);
\path (A) edge (B) (B) edge (B|-E.north) (D.-60) edge (E.north-|D.-60)
(E) edge (F) (F) edge (G) (C.east) edge (C.east-|D.west);
\end{scope}
\end{scope}
\path ($(F)+(5.5em,0)$) coordinate (aux);
\node[draw,inner sep=0.5em,dashed,fit=(B) (E) (F) (aux),
label={[anchor=north east]north east:Meta learner}] (F1) {};
\node[draw,inner sep=0.5em,dashed,fit=(C) (E) (F1),
label={[anchor=north east]north east:Recommender system}] (F2) {};
\end{tikzpicture}
\end{document}
答案2
\documentclass[tikz,border=10pt]{standalone}
%%%<
\usepackage{verbatim}
%%%>
\begin{comment}
:Title: Flowchart
:Tags: Diagrams;Flowcharts;Node positioning;Nodes and shapes
:Author: Qrrbrbirlbel
:Slug: flowchart
This example flowchart uses the positioning-plus library and the
node-families library by the same author. The fit library is implicitly loaded
by positioning-plus, the backgrounds library is used to draw stuff behind
other stuff, the calc library for some coordinate calculations and the
shapes.geometric library for the ellipse shape.
This example was written by Qrrbrbirlbel answering a question on TeX.SE.
\end{comment}
\usetikzlibrary{shapes.geometric,backgrounds,
positioning-plus,node-families,calc}
\tikzset{
basic box/.style = {
shape = rectangle,
align = center,
draw = #1,
fill = #1!25,
rounded corners},
header node/.style = {
Minimum Width = header nodes,
font = \strut\Large\ttfamily,
text depth = +0pt,
fill = white,
draw},
header/.style = {%
inner ysep = +1.5em,
append after command = {
\pgfextra{\let\TikZlastnode\tikzlastnode}
node [header node] (header-\TikZlastnode) at (\TikZlastnode.north) {#1}
node [span = (\TikZlastnode)(header-\TikZlastnode)]
at (fit bounding box) (h-\TikZlastnode) {}
}
},
hv/.style = {to path = {-|(\tikztotarget)\tikztonodes}},
vh/.style = {to path = {|-(\tikztotarget)\tikztonodes}},
fat blue line/.style = {ultra thick, blue}
}
\begin{document}
\begin{tikzpicture}[node distance = 1.2cm, thick, nodes = {align = center},
>=latex]
\node[Minimum Width = loop, shape = ellipse, fill = red] (imp-sol)
{ellipsoid box};
\node[Minimum Width = loop, fill = yellow, below = of imp-sol] (rec-box)
{rectangular box, and very wiiiiiiiiiiiiiiide\\2nd line};
\node[shift = (left:.5*x_node_dist)] at
($(imp-sol.west|-imp-sol.south)!.5!(rec-box.north west)$) (for-1)
{formula 1};
\node[shift = (right:.5*x_node_dist)] at
($(imp-sol.east|-imp-sol.south)!.5!(rec-box.north east)$) (for-2)
{formula 2};
\begin{scope}[on background layer]
\node[fit = (for-1)(for-2)(imp-sol)(rec-box), basic box = blue,
header = DMFT loop] (dmft-l) {};
\end{scope}
\path[very thick, blue, hv] (rec-box) edge[->] (for-1) edge[<-] (for-2)
(imp-sol) edge[->] (for-2) edge[<-] (for-1);
\node[east above = of dmft-l, basic box = green, header = DMFT prelude]
(dmft-p) {Math and text math and text math and text\\
math and text math and text math and text};
\node[north left = of dmft-l, basic box = green, header = $\rho$ update,
shift = (down:y_node_dist)] (rho)
{Much more text much more text\\much more text much more text};
\node[basic box = blue, header = DFT part, anchor = north] at
(dmft-p.north-|rho) (dft) {So much text so much text so much text\\
I think I need \texttt{tikz-lipsum}\\or something like that.};
\node[basic box = green, anchor = north] at
($(dft.north east)!.5!(dmft-p.north west)$) (upd) {update\\$math$};
\path[fat blue line, <-, dashed, vh] (rho) edge
({$(rho.south)!.5!(dmft-l.south)$}-|dmft-l.south west);
\path[fat blue line, ->]
({$(upd.south)!.5!(dmft-p.south)$}-|dmft-p.south west)
coordinate (@) edge[<-, solid] coordinate[pos=.15] (@s)
coordinate[pos=.9] (@e) (@-|dft.east)
{[every edge/.append style=dashed, vh] (@s) edge[<-] (upd) (@e) edge (upd)}
(h-rho) edge[dashed] (dft)
($(dmft-p.south)!.5!(dmft-p.south east)$)
coordinate (@) edge (@|-dmft-l.north);
\end{tikzpicture}
\end{document}
这应该能给你一个想法
答案3
\documentclass[]{article}
\usepackage{verbatim}
\begin{comment}
:Title: Actor Transaction Diagram
A sample of a global Actor Transaction Diagram or ATD of the
`Design & Engineering Methodology for Organizations (DEMO) methodology`__.
The most interesting part of the example is the definition of the custom
``square`` arrow the and ``diamond in circle`` node shape.
**Note**: The ``square`` arrow is now available in the CVS version of PGF.
In the example the arrow shape has been renamed to ``squarea`` to avoid conflict.
.. __: http://softwaredesign.nl/index.php?pageID=28
\end{comment}
\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,fit,shapes,calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A square shaped arrow
% The arrow has been renamed to squarea to avoid conflict with the square arrow
% defined in the CVS version of PGF
\newdimen\arrowsize
\pgfarrowsdeclare{squarea}{squarea}
{
\arrowsize=0.4pt
\advance\arrowsize by.275\pgflinewidth%
\pgfarrowsleftextend{+-\arrowsize}
\advance\arrowsize by.5\pgflinewidth
\pgfarrowsrightextend{+\arrowsize}
}
{
\arrowsize=0.4pt
\advance\arrowsize by.275\pgflinewidth%
\pgfsetdash{}{+0pt}
\pgfsetroundjoin
\pgfpathmoveto{\pgfqpoint{1\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfqpoint{-7\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfqpoint{-7\arrowsize}{-4\arrowsize}}
\pgfpathlineto{\pgfqpoint{1\arrowsize}{-4\arrowsize}}
\pgfpathclose
\pgfusepathqfillstroke
}
% A open square shaped arrow
\pgfarrowsdeclare{open squarea}{open squarea}%{{-.5bp}{8.5bp}}
{
\arrowsize=0.4pt
\advance\arrowsize by.275\pgflinewidth%
\pgfarrowsleftextend{+-.5\pgflinewidth}
\advance\arrowsize by7\arrowsize
\advance\arrowsize by.5\pgflinewidth
\pgfarrowsrightextend{+\arrowsize}
}
{
\arrowsize=0.4pt
\advance\arrowsize by.275\pgflinewidth%
\pgfsetdash{}{+0pt}
\pgfsetroundjoin
\pgfpathmoveto{\pgfqpoint{8\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfqpoint{0\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfqpoint{0\arrowsize}{-4\arrowsize}}
\pgfpathlineto{\pgfqpoint{8\arrowsize}{-4\arrowsize}}
\pgfpathclose
\pgfusepathqstroke
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A circle and diamond shape
\makeatletter
\newdimen\tempa
\newdimen\tempb
\pgfdeclareshape{diamond in circle}{
\inheritsavedanchors[from=diamond] % this is a diamond
\inheritsavedanchors[from=circle] % this is a circle
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{radius}
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{east}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{anchorborder}
\saveddimen\radius{%
%
% Caculate ``height radius''
%
\pgf@ya=.5\ht\pgfnodeparttextbox%
\advance\pgf@ya by.5\dp\pgfnodeparttextbox%
\pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}%
\advance\pgf@ya by\pgf@yb%
%
% Caculate ``width radius''
%
\pgf@xa=.5\wd\pgfnodeparttextbox%
\pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}%
\advance\pgf@xa by\pgf@xb%
%
% Calculate length of radius vector:
%
\pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
\ifdim\pgf@x>\pgf@y%
\c@pgf@counta=\pgf@x%
\ifnum\c@pgf@counta=0\relax%
\else%
\divide\c@pgf@counta by 255\relax%
\pgf@xa=16\pgf@xa\relax%
\divide\pgf@xa by\c@pgf@counta%
\pgf@xa=16\pgf@xa\relax%
\fi%
\else%
\c@pgf@counta=\pgf@y%
\ifnum\c@pgf@counta=0\relax%
\else%
\divide\c@pgf@counta by 255\relax%
\pgf@ya=16\pgf@ya\relax%
\divide\pgf@ya by\c@pgf@counta%
\pgf@xa=16\pgf@ya\relax%
\fi%
\fi%
\pgf@x=\pgf@xa%
%
% If necessary, adjust radius so that the size requirements are
% met:
%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}%
\ifdim\pgf@x<.5\pgf@xb%
\pgf@x=.5\pgf@xb%
\fi%
\ifdim\pgf@x<.5\pgf@yb%
\pgf@x=.5\pgf@yb%
\fi%
%
% Now, add larger of outer sepearations.
%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\advance\pgf@x by\pgf@yb%
\else%
\advance\pgf@x by\pgf@xb%
\fi%
}
\backgroundpath{
\tempa=\radius
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\advance\tempa by-\pgf@yb%
\else%
\advance\tempa by-\pgf@xb%
\fi%
\pgfpathmoveto{\centerpoint\advance\pgf@x by\radius}%
\pgfpathlineto{\centerpoint\advance\pgf@y by\radius}%
\pgfpathlineto{\centerpoint\advance\pgf@x by-\radius}%
\pgfpathlineto{\centerpoint\advance\pgf@y by-\radius}%
\pgfpathclose%
}
\behindbackgroundpath{
\tempa=\radius%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\advance\tempa by-\pgf@yb%
\else%
\advance\tempa by-\pgf@xb%
\fi%
\pgfpathcircle{\centerpoint}{\tempa}%
}
}
\makeatother
\newcommand{\parameter}[1]{$\langle\mbox{#1}\rangle$}
\title{A LaTeX Article}
\author{Gabor Tjong A Hung}
\begin{document}
\tikzset{
every transaction/.style = {fill=white!100},
transaction/.style = {diamond in circle, draw, minimum size=6mm, every transaction},
every actor role/.style = {},
actor role/.style = {rectangle, draw=black!80, ultra thick,
minimum size = 6mm, every actor role},
composite actor role/.style = {fill=gray!80, actor role},
elementary actor role/.style = {fill=white!100, actor role},
initiator/.style = {-},
executor/.style = {<-, >=squarea},
system/.style = {rectangle, fill=white!100, ultra thick, draw=black!80,
minimum height=60mm, minimum width=4cm,outer sep=0pt}}
\begin{figure}[h]
\centering
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\begin{tikzpicture}[node distance=1cm, on grid]
\begin{pgfonlayer}{background}
\node [system] (system) at (0,3){};
\end{pgfonlayer}
\node [composite actor role] (CA01) [minimum height=48mm] at ( -4,3) {CA01};
\node [above] at (CA01.north) {Client};
\node [transaction] (T01) at( $(system.south west)!.66!(system.north west)$)
{T01} edge [initiator] (CA01.south east |- T01);
\node [composite actor role] (CA03) at ( $(system.south)!.66!(system.north)$)
{CA03} edge [executor] (T01);
\node [above] at (CA03.north) {GDSS facilitator};
\node [transaction] (T02) at ( $(system.south east)!.66!(system.north east)$)
{T02} edge [initiator] (CA03);
\path (T02)++(2,0) node [composite actor role] (CA02) [minimum height=24mm]
{CA02} edge [executor] (T02);
\node [above] at (CA02.north) {Participant};
\node [transaction] (T03) at ( $(system.south west)!.33!(system.north west)$)
{T03} edge [initiator] (CA01.south east |- T03);
\node [composite actor role] (CA04) at ( $(system.south)!.33!(system.north)$)
{CA04} edge [executor] (T03);
\node [above] at (CA04.north) {GDSS analysist};
\end{tikzpicture}
\\[2em]
\begin{tabular}{@{T}l@{ }l@{ }p{5cm}}
\toprule
ID & Transaction Type (T) & Result Type (R)\\
\midrule
01 & Facilitate meeting & Meeting has been facilitated.\\
02 & Perform Agendum & Agendum has been performed by \parameter{participant}
on \parameter{time}.\\
03 & Analysis & Analysis has been made.\\
\bottomrule
\end{tabular}\label{tab:trt_datd}
\caption{Global ATD}
\end{figure}
\end{document
答案4
\documentclass[tikz,border=4mm]{standalone}
\usetikzlibrary{positioning,fit,calc}
\tikzset{block/.style={draw,thick,text width=2cm,minimum height=1cm,align=center},
line/.style={-latex}
}
\begin{document}
\begin{tikzpicture}
\node[block] (a) {Dam};
\node[block,right=of a] (b) {Checkdam};
\node[block,right= 3cm of b] (c) {Checkdam};
\node[block,right=of c] (d) {Dam};
\node[block] (e) at ([yshift=-2cm]$(b)!0.5!(c)$) {Gate};
\node[draw,inner xsep=5mm,inner ysep=8mm,fit=(a)(b),label={130:A}](f){};
\node[draw,inner xsep=5mm,inner ysep=8mm,fit=(c)(d),label={50:B}]{};
\node[draw,inner xsep=5mm,inner ysep=6mm,fit=(b)(c)]{};
\draw[line] (a)-- (b);
\draw[line] (b) -- (f.east);
\draw[line] (f.east) -- (c)node[pos=0.4,above]{flow};
\draw[line] (c)-- (d);
\draw[line] (e)-- ($(b)!0.5!(c)$);
\end{tikzpicture}
\end{document}