tikz 中的分区矩阵

tikz 中的分区矩阵

我得到了以下分区矩阵

通过此tikz代码:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing, calc, positioning}

\begin{document}

% Matrix U with its Column and Row variances
\begin{center}

\begin{tikzpicture}
\matrix [matrix of math nodes] (eqU) { 
\mathbf{U}= \\
};

\matrix [right=2pt of eqU, matrix of math nodes,left delimiter=[,right delimiter={]},row sep=0.2cm,column sep=0.2cm] (U) { 
 u_{1}^{\left(1\right)} & \ldots & u_{1}^{\left(j\right)} & \ldots & u_{1}^{\left(t\right)}\\
\vdots & \ddots & \vdots & \ddots & \vdots\\
u_{k}^{\left(1\right)} & \ldots & u_{k}^{\left(j\right)} & \ldots & u_{k}^{\left(t\right)}\\
\vdots & \ddots & \vdots & \ddots & \vdots\\
u_{r}^{\left(1\right)} & \ldots & u_{r}^{\left(j\right)} & \ldots & u_{r}^{\left(t\right)} \\ 
};

\draw[color=red] (U-1-1.north west) -- (U-1-1.north east) -- (U-5-1.south east) -- (U-5-1.south west)-- (U-1-1.north west);
\draw[color=red] (U-1-3.north west) -- (U-1-3.north east) -- (U-5-3.south east) -- (U-5-3.south west)-- (U-1-3.north west);
\draw[color=red] (U-1-5.north west) -- (U-1-5.north east) -- (U-5-5.south east) -- (U-5-5.south west)-- (U-1-5.north west);

\draw[color=blue, dashed] (U-1-1.north west) -- (U-1-5.north east) -- (U-1-5.south east) -- (U-1-5.south west)-- (U-1-1.south west);
\draw[color=blue, dashed] (U-3-1.north west) -- (U-3-5.north east) -- (U-3-5.south east) -- (U-3-5.south west)-- (U-3-1.south west);
\draw[color=blue, dashed] (U-5-1.north west) -- (U-5-5.north east) -- (U-5-5.south east) -- (U-5-5.south west)-- (U-5-1.south west);

\node[below=5pt  of U-5-1, red] (below-1) {$\mathbf{G}^{\left(1, 1\right)}$}; 
\node[below=12pt of U-5-2, red] (below-2) {\ldots};
\node[below=5pt  of U-5-3, red] (below-3) {$\mathbf{G}^{\left(j, j\right)}$};
\node[below=12pt of U-5-4, red] (below-4) {\ldots};
\node[below=5pt  of U-5-5, red] (below-5) {$\mathbf{G}^{\left(t, t\right)}$}; 

\draw[<->, thick, red, bend right=60]       (U-5-1.south) to  node[below, pos=0.5,sloped]   {$\mathbf{G}^{\left(1, j\right)}$} (U-5-3.south);
\draw[<->, thick, red, bend right=60]       (U-5-3.south) to  node[below, pos=0.5,sloped]   {$\mathbf{G}^{\left(j, t\right)}$} (U-5-5.south);

\node[right=7pt  of U-1-5, blue] (right-1) {$\mathbf{H}_{11}$}; 
\node[right=17pt of U-2-5, blue] (right-2) {\vdots}; 
\node[right=7pt  of U-3-5, blue] (right-3) {$\mathbf{H}_{kk}$};
\node[right=17pt of U-4-5, blue] (right-4) {\vdots}; 
\node[right=7pt  of U-5-5, blue] (right-5) {$\mathbf{H}_{qq}$}; 

\draw[<->, thick, blue, bend left=60]       (U-1-5) to  node[above, pos=0.5]    {$\mathbf{H}_{1k}$} (U-3-5);
\draw[<->, thick, blue, bend left=60]       (U-3-5) to  node[above, pos=0.5]    {$\mathbf{H}_{jk}$} (U-5-5);

\end{tikzpicture}

\end{center}

\end{document}

我对此输出有一些问题(在以下问题中描述)。

问题/疑问

  1. 连接列的箭头是重叠的,而且我想将它们提取出来,连接行的箭头也同样如此。
  2. 连接行的箭头节点没有很好地对齐。
  3. 如何进一步扩展箭头的阴影以区别于列阴影?

我非常感谢您帮助我并花时间解决这些问题,并期待任何改进此分区矩阵的建议和建议。谢谢

答案1

我认为您可以在代码和演示方面做更多简化。一旦开始使其可视化,在我看来,您必须全力以赴。换句话说,即使它们没有强烈的视觉提示,它们也应该具有很强的含义。正如您所抱怨的那样,这里的事情是乱码,并且由于重叠,您的行和列矩形看起来像是一个错误,因为它们没有足够强烈的含义。另外,您不需要使用,\ldots,\vdots因为您已经在使用 TikZ!我不知道GH地图的作用是什么,但您不应该试图将它们挤进额外的行中,因为您已经决定为整个矩阵着色。你不应该停下来,直到它有意义为止。所以我的建议是(可能需要进一步调整):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\begin{document}

What if the rest of the world was hopelessly drowning in vain? Where would our 
self pity run? Suddenly everyone cares and we perform some row/column operations as the 
following:
\[
\mathbf{U} = \begin{tikzpicture}[baseline=(U.center)]
\matrix [matrix of math nodes,left delimiter=[,right delimiter={]},nodes={outer sep=1pt}] (U) { 
u_{1}^{\left(1\right)}  &[1cm] u_{1}^{\left(j\right)}    &[1cm] u_{1}^{\left(t\right)}      \\[1cm]
u_{k}^{\left(1\right)}  &      u_{k}^{\left(j\right)}    &      u_{k}^{\left(t\right)}      \\[1cm]
u_{r}^{\left(1\right)}  &      u_{r}^{\left(j\right)}    &      u_{r}^{\left(t\right)}      \\
};
\foreach \x/\y/\z in {1/1/1,2/k/j,3/q/t}{
\draw[red] ([shift={(1pt,2pt)}]U-1-\x.north west) rectangle ([shift={(-1pt,-2pt)}]U-3-\x.south east);
\draw[blue,dashed] ([shift={(-2pt,-1pt)}]U-\x-1.north west) rectangle ([shift={(2pt,1pt)}]U-\x-3.south east);
\draw[thick,loosely dotted] (U-\x-1) -- (U-\x-2) -- (U-\x-3);
\draw[thick,loosely dotted] (U-1-\x) -- (U-2-\x) -- (U-3-\x);
\node[blue,right = 3 mm of U-\x-3] (U-\x-4) {$\mathbf{H}_{\y\y}$};
\node[red,below= 1 mm of U-3-\x] (U-4-\x) {$\mathbf{G}^{(\z,\z)}$};
};
\draw[thick,loosely dotted] (U-1-1) -- (U-2-2) -- (U-3-3) (U-1-2) -- (U-2-3) (U-2-1) -- (U-3-2);
\draw[thick,loosely dotted,red] (U-4-1) -- (U-4-2) -- (U-4-3);
\draw[thick,loosely dotted,blue] (U-1-4) -- (U-2-4) -- (U-3-4);
\draw[<->, thick, red, bend right=45] (U-4-1) to node[below, pos=0.5,sloped]   {$\mathbf{G}^{\left(1, j\right)}$} (U-4-2);
\draw[<->, thick, red, bend right=45] (U-4-2) to node[below, pos=0.5,sloped]   {$\mathbf{G}^{\left(j, t\right)}$}  (U-4-3);
\draw[<->, thick, blue, bend left=60] (U-1-4) to  node[right, pos=0.5]    {$\mathbf{H}_{1k}$} (U-2-4);
\draw[<->, thick, blue, bend left=60] (U-2-4) to  node[right, pos=0.5]    {$\mathbf{H}_{jk}$}  (U-3-4);
\end{tikzpicture}
\]
where we used colorful lines in the sand. People in prayer for me,everyone there for me. Sometimes I feel 
I should face this alone. My soul exposed. It calms me to know that I won't.
\end{document}

在此处输入图片描述


是我还是底部的G地图是笑脸?

相关内容