TikZ:点比较表

TikZ:点比较表

也许我在搜索中使用了错误的术语。有人能给我一个线索/链接/想法,告诉我这样的点比较矩阵/网格是如何实现的吗?我不擅长使用 TikZ,所以如果我的问题可能很幼稚,请多包涵。

在此处输入图片描述

答案1

一种选择是使用matrixTiZ。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{matrix,fit}
\begin{document}
\begin{tikzpicture}[dot/.style={circle,fill,inner sep=1.5pt},
    line cap=rect,font=\sffamily]
 \matrix[matrix of nodes,cells={nodes={align=center}},
 nodes in empty cells,column sep=1ex,
 column 1/.style={nodes={anchor=west,text depth=0.25ex},column sep=1em}] (m)
  { & {\begin{tabular}[b]{@{}c@{}}Dependality\\ and Security\\ Provision\end{tabular}}  
   & {\begin{tabular}[b]{@{}c@{}}Dependality\\ and Security\\ Analysis\end{tabular}} 
   & {\begin{tabular}[b]{@{}c@{}}Fault\\ Avoidance\end{tabular}} 
   & {\begin{tabular}[b]{@{}c@{}}Fault\\ Acceptance\end{tabular}} \\
   Fault prevention & |[dot]| & &|[dot]| &\\   
   Fault tolerance & |[dot]| & & &|[dot]|\\   
   Fault removal & & |[dot]|  & |[dot]|&\\   
   Fault Forecasting & &|[dot]|  & & |[dot]|\\   
  };
  \draw foreach \x in {2,...,\pgfmatrixcurrentcolumn}
   {(m-1-\x.south) -- (m.south-|m-1-\x.south)}
   foreach \x in {2,...,\pgfmatrixcurrentrow}
   {(m-\x-1.west) -- ([xshift=-1em]m.west|-m-\x-1.west) coordinate (l\x)
    (m-\x-1.east) -- ([xshift=1ex]m.east|-m-\x-1.east)}
    (l2) -- (l\the\numexpr\pgfmatrixcurrentrow) coordinate[midway] (l)
   (l) -- ++ (-1em,0) node[left,align=left]{%
   Means for\\ Dependability\\ and Security};
  \node[draw,inner sep=0pt,fit=(m-1-2.west|-m.north)(m-1-3.east|-m.south)](f23){}; 
  \node[draw,inner sep=0pt,fit=(m-1-4.west|-m.north)(m-1-5.east|-m.south)](f45){}; 
  \node[draw,fit=(current bounding box)]{};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

在此处输入图片描述

我提出一个初步的解决方案,首先我们画出幻灯片的结构(见下图)。
在此处输入图片描述 然后,只需沿线添加节点并进行一些最终的样式修改即可。点是在最后添加的圆圈。

代码

\documentclass[11pt, border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{math}
\begin{document}

\tikzset{
  v/.style={pos=0, below, text width=2.4 cm, text centered, text depth=7ex}
}
\tikzmath{ real \d; \d = .3; }
\begin{tikzpicture}[every node/.style={fill=white, scale=.7}, y={(0, .8)}]
  \draw (-1.25, -1.8) rectangle (14.75, 4.5);
  \draw (-1, .5) -- (1.5, .5) node[pos=0, right, text width=2.4 cm]
  {Means for\\ Dependability and Security};  
  \draw (1.5, -1) -- ++(0, 3);
  
  \draw (1.5, 2) -- ++(13, 0) node[pos=.03, right] {Fault Prevention};
  \draw (1.5, 1) -- ++(13, 0) node[pos=.03, right] {Fault Tolerance};
  \draw (1.5, 0) -- ++(13, 0) node[pos=.03, right] {Fault Removal};
  \draw (1.5, -1) -- ++(13, 0) node[pos=.03, right] {Fault Forecasting};
  
  \draw (5-\d, -1-2*\d) rectangle ++(4+2*\d, 5+3*\d);
  \draw (6, 4) -- ++(0, -5-\d) node[v] {Dependability and Security Provision};
  \draw (8, 4) -- ++(0, -5-\d) node[v] {Dependability and Security Analysis};
  
  \draw (10-\d, -1-2*\d) rectangle ++(4+2*\d, 5+3*\d);
  \draw (11, 4) -- ++(0, -5-\d) node[v] {Fault Avoidance};
  \draw (13, 4) -- ++(0, -5-\d) node[v] {Fault Acceptance};
  
  \foreach \j in {1, 2}{\filldraw[black] (6, \j) circle (3pt);}
  \foreach \j in {-1, 0}{\filldraw[black] (8, \j) circle (3pt);}
  \foreach \j in {0, 2}{\filldraw[black] (11, \j) circle (3pt);}
  \foreach \j in {-1, 1}{\filldraw[black] (13, \j) circle (3pt);}
\end{tikzpicture}
\end{document}

相关内容