答案1
这里有一种方法可以做到这一点,在一个简单的tabular
环境中,一些多行和pstricks
,在相关位置(在空单元格中或行之间)为外部多边形插入五个空节点,并从它们构建 24 个其他线条节点。
\documentclass[svgnames, 12pt]{article}
\usepackage[utf8]{inputenc} %
\usepackage{array, multirow}
\usepackage{amsmath}
\usepackage{pst-node, multido, auto-pst-pdf}
\newcounter{dept}
\newcommand*{\inbetween}[1]{\multirow{2}{*}[-0.2ex]{\thickspace#1}}
\begin{document}
\psset{dotsize=2pt, linecolor=red, linejoin=1,linewidth =0.4pt}
\setlength{\extrarowheight}{2pt}
\[ \setcounter{dept}{0}
\renewcommand{\arraystretch}{1.2}
\psset{dotsize=2pt, linecolor=red, linejoin=1,linewidth =0.4pt}
\begin{tabular}{>{\stepcounter{dept}\color{Tomato}\textbf{Dept\,%
\Alph{dept}}}lc*{6}{>{{}\enspace\color{Tomato}\bfseries}c}}
\noalign{\pnode[-1.5em, 0]{A}}
&\pnode[0, 2.8ex]{B} & \inbetween{5}\\
& & \inbetween{6} & 2 & \inbetween{6} & \\
& & \inbetween{4} & 1 & \inbetween{3} & 2 & \inbetween{4} & \\
& & \inbetween{4} & 4 & \inbetween{5} & 1 & \inbetween{6} & 3 \pnode[1.5em, 0.8ex]{S}\\
& & \inbetween{2} & 5 & \inbetween{2} & 1\\
& \pnode[-\tabcolsep, -4.8ex]{D} & \inbetween{3} & 3 \\%
& \\
\noalign{\pnode[-1.5em, 0ex]{C}}
\end{tabular}
\psset{linecolor=LightSlateGray, linewidth=1.2pt, linejoin=1,linearc =0.05}
\pspolygon[fillstyle=solid, fillcolor=SlateGray, opacity = 0.15,linejoin=1](A)(B)(S)(D)(C)
\multido{\n=0.142+0.143, \i=1+1}{6}{%
\psLNode(A)(C){\n}{a\i} \psLNode(B)(D){\n}{b\i}
\psLNode(B)(S){\n}{r\i} \psLNode(S)(D){\n}{s\i}
\psline(a \i)(b\i)(r\i) \psline(b\i)(s\i)
}%
\]
\end{document}
答案2
我最终使用了这个代码:
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{shapes,arrows}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=3.3em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=8em, text centered, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=0.90][node distance = 2cm, auto]
% Place nodes
\node [start] (1) {Laser cutter};
\node [start, below of=1, node distance=1.51cm](2){Laser cutter};
\node [start, below of=2, node distance=1.51cm](3){Laser cutter};
\node [start, below of=3, node distance=1.51cm](4){Laser cutter};
\node [start, below of=4, node distance=1.51cm](5){Laser cutter};
\node [start, below of=5, node distance=1.51cm](6){Laser cutter};
\node [start, below of=6, node distance=1.51cm](7){Laser cutter};
%% Row number 1
\node [decision, below of=1, node distance=1.5cm, yshift=0.75cm, xshift=2.42cm] (a1) {3};
\node [decision, below of=a1, node distance=1.51cm] (a2) {4};
\node [decision, below of=a2, node distance=1.51cm] (a3) {5};
\node [decision, below of=a3, node distance=1.51cm] (a4) {6};
\node [decision, below of=a4, node distance=1.51cm] (a5) {6};
\node [decision, below of=a5, node distance=1.51cm] (a6) {6};
%% Row number 2
\node [decision, below of=a1, node distance=1.5cm, yshift=0.75cm, xshift=0.75cm] (b1) {3};
\node [decision, below of=b1, node distance=1.51cm] (b2) {4};
\node [decision, below of=b2, node distance=1.51cm] (b3) {5};
\node [decision, below of=b3, node distance=1.51cm] (b4) {6};
\node [decision, below of=b4, node distance=1.51cm] (b5) {6};
%% Row number 3
\node [decision, below of=b1, node distance=1.5cm, yshift=0.75cm, xshift=.75cm] (c1) {3};
\node [decision, below of=c1, node distance=1.51cm] (c2) {4};
\node [decision, below of=c2, node distance=1.51cm] (c3) {5};
\node [decision, below of=c3, node distance=1.51cm] (c4) {6};
%% Row number 4
\node [decision, below of=c1, node distance=1.5cm, yshift=0.75cm, xshift=.75cm] (d1) {3};
\node [decision, below of=d1, node distance=1.51cm] (d2) {4};
\node [decision, below of=d2, node distance=1.51cm] (d3) {5};
%% Row number 5
\node [decision, below of=d1, node distance=1.5cm, yshift=0.75cm, xshift=.75cm] (e1) {3};
\node [decision, below of=e1, node distance=1.51cm] (e2) {4};
%% Row number 6
\node [decision, below of=e1, node distance=1.5cm, yshift=0.75cm, xshift=.75cm] (f1) {3};
\end{tikzpicture}
\end{figure}
谢谢大家的帮助!
答案3
\documentclass{standalone}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{tikzpicture}[line cap =round]
\pgfmathsetmacro\angle{30}
\pgfmathsetmacro\textLength{2}
\pgfmathsetmacro\height{0.6}
\def\lineColor{gray}
\def\textColor{red}
\def\backColor{blue!10}
\pgfmathsetmacro\numeroLinhas{7}
\pgfmathsetmacro\cte{\height^2/tan(\angle)}
\fill[\backColor] (0,0) -- ++(\textLength,0) -- ++(\numeroLinhas*\cte,0.5*\numeroLinhas*\height) -- ++(-\numeroLinhas*\cte,0.5*\numeroLinhas*\height) -- ++(-\textLength,0) -- cycle;
\draw[thick,\lineColor] (0,\numeroLinhas*\height) -- (0,0);
\foreach \x in {0,...,\numeroLinhas}{
\draw[thick,\lineColor] (0,\x*\height) -- +(\textLength,0);
}
\foreach \x/\y in {0/{Dept. A},1/{Dept. B},2/{Dept. C},3/{Dept. D},4/{Dept. E},5/{Dept. F},6/{Dept. G}}{
\pgfmathsetmacro\ka{(6.5-\x)*\height}
\pgfmathsetmacro\kb{(\numeroLinhas-\x)*\height}
\node[\textColor] at (0.5*\textLength,\ka) {\y};
\draw[thick,\lineColor] (\textLength,\kb) -- +(\numeroLinhas*\cte-\x*\cte,-0.5*\numeroLinhas*\height+0.5*\x*\height);
\draw[thick,\lineColor] (\textLength,\x*\height) -- +(\numeroLinhas*\cte-\x*\cte,+0.5*\numeroLinhas*\height-0.5*\x*\height);
}
\foreach \x/\y in {0/5,1/6,2/4,3/4,4/2,5/3}{
\pgfmathsetmacro\kc{(6-\x)*\height}
\node[\textColor] at (\textLength+\cte ,\kc) {\y};
}
\foreach \x/\y in {0/2,1/1,2/4,3/5,4/3}{
\pgfmathsetmacro\kd{(5.5-\x)*\height}
\node[\textColor] at (\textLength+2*\cte, \kd) {\y};
}
\foreach \x/\y in {0/6,1/3,2/5,3/2}{
\pgfmathsetmacro\ke{(5-\x)*\height}
\node[\textColor] at (\textLength+3*\cte ,\ke) {\y};
}
\foreach \x/\y in {0/2,1/1,2/1}{
\pgfmathsetmacro\kf{(4.5-\x)*\height}
\node[\textColor] at (\textLength+4*\cte ,\kf) {\y};
}
\foreach \x/\y in {0/2,1/1}{
\pgfmathsetmacro\kg{(4-\x)*\height}
\node[\textColor] at (\textLength+5*\cte ,\kg) {\y};
}
\node[\textColor] at (\textLength+6*\cte ,0.5*\numeroLinhas*\height) {3};
\end{tikzpicture}[![enter image description here][1]][1]
\end{document}