自定义 tikzset 图片的旋转矩阵

自定义 tikzset 图片的旋转矩阵

旋转这个 TikZ 图是一种简单的方法吗?我在最后使用矩阵来堆叠四个类似的图表。

\documentclass[tikz,border=10pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{bayesnet}
\usepackage{bm}

\newcommand\xo{\bm{x}_{\scriptstyle\scriptscriptstyle\mathcal{O}}}
\newcommand\xm{\bm{x}_{\scriptstyle\scriptscriptstyle\mathcal{M}}}

\usetikzlibrary{backgrounds}
\usetikzlibrary{positioning}

\tikzset{
    net_qz/.pic={

% nodes
\node[latent] (a) {};%
\node[const,below= of a,xshift=0.83cm,yshift=1cm] (title) {\scriptsize $q_{\bm{\phi}}(\bm{z}|\xo,\xm,y)$};%
\node[const,right=of a,xshift=-0.7cm] (aa) {$\cdots$};%
\node[latent,right=of a] (b) {};%
\node[latent,above=of a,xshift=-0.3cm,yshift=-0.7cm] (c) {}; %
\node[const,right=of c,xshift=-0.88cm] (aaa) {$\cdots \cdots \cdots$};%
\node[latent,above=of b,xshift=0.3cm,yshift=-0.7cm] (d) {}; %
\node[latent,above=of c,yshift=-0.5cm] (e) {}; %
\node[const,right=of e,xshift=-0.88cm] (aaaa) {$\cdots \cdots \cdots$};%
\node[latent,above=of d,yshift=-0.5cm] (f) {}; %
\node[const,above=of e,yshift=-0.5cm,xshift=15] (mu) {$\bm{\mu}$};%
\node[const,above=of f,yshift=-0.5cm,xshift=-15] (sigma) {$\bm{\sigma}$};%
\node[latent,above=of mu,yshift=-0.5cm,minimum size=0.2cm] (plus) {$+$};%
\node[latent,above=of sigma,yshift=-0.45cm,minimum size=0.45cm] (times) {$\times$};%
\node[const,left=of plus,xshift=.2cm] (zeta) {$\bm{z}$};%
\node[latent,right=of times,xshift=-.2cm,minimum size=0.43cm] (eps) {$\bm{\epsilon}$};%

% edges
\edge[-] {a}{c,d} 
\edge[-] {b}{c,d} 
\edge[-] {c}{e,f} 
\edge[-] {d}{e,f} 
\edge[-] {e}{mu,sigma} 
\edge[-] {f}{mu,sigma} 
\edge{mu}{plus}
\edge{sigma}{times}
\edge{eps}{times}
\edge{times}{plus}
\edge{plus}{zeta}
}
}

\begin{document}
\begin{tikzpicture}

\matrix(A)[column sep=5mm, row sep=0mm]{
\pic{net_qz};\\
};

\end{tikzpicture}

\end{document}

答案1

像这样?

\pic[rotate=90,transform shape]{net_qz};

相关内容