我如何在 tikz 中旋转石川图片?

我如何在 tikz 中旋转石川图片?

我在乳胶中开发了石川图,但我无法旋转 90° 以在 PDF 中看到垂直图片。请帮助我。遵循代码:

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shapes.geometric,positioning,matrix}
\tikzset{
  ishikawa/.style={align=center, inner sep=0pt},
  matter/.style  ={rectangle, minimum size=6mm, very thick, draw=red!70!black!40,
    top color=white, bottom color=red!50!black!20, font=\itshape},
  level_1/.style ={ellipse, node distance=60pt, minimum size=6mm, very thick,
    draw=red!50!black!50, top color=white, bottom color=red!50!black!20, font=\itshape},
  level_2/.style={rectangle, minimum size=6mm, font=\itshape, font=\scriptsize}}
\tikzset{
  rows/.style 2 args={@/.style={row ##1/.style={#2}},@/.list={#1}},
  cols/.style 2 args={@/.style={column ##1/.style={#2}},@/.list={#1}},
}
\begin{document}
\begin{tikzpicture}
\matrix[
  matrix of nodes,
  row sep=3cm,
  column sep=1cm,
  rows={1,3}{nodes=level_1},
  rows={2}{nodes=matter,anchor=center}
] (m) {
Detección &  & Legislación  & \\
         &         &             & Pesca IUU \\
 Económico  &   & Pescadores     & \\
};
\path[very thick,
  toarr/.style={->, shorten <=+0pt, shorten >=+.1cm},
  fromarr/.style={<-, shorten >=+0pt, shorten <=+.1cm}]

  % Mid left to right arrow
  [toarr]
  (m-1-1|-m-2-4) edge (m-2-4)

  % The Cause 1 arrows
  (m-1-1) edge[xslant=-.5]
    coordinate[pos=.3]   (@-1-1-1)
    coordinate[pos=.45]   (@-1-1-2)
    coordinate[pos=.65]   (@-1-1-3)
    coordinate[near end] (@-1-1-4) (m-1-1|-m-2-4)
  [fromarr]
  (@-1-1-1) edge node[above, level_2]{\textbf{↓} Efectividad } ++ (left:4.5cm)
  (@-1-1-2) edge node[above, level_2]{\textbf{↓} Disponibilidad } ++ (right:4.5cm)
   (@-1-1-3) edge node[above, level_2]{Desconocimiento } ++ (left:4.5cm)
  (@-1-1-4) edge node[above, level_2]{\textbf{\textbf{↓}} Disponibilidad } ++ (right:4.5cm)
  
 
  % The Cause 3 arrows
  (m-1-3) edge[xslant=-.5]
    coordinate[pos=.3]   (@-1-3-1)
    coordinate[near end] (@-1-3-2) (m-1-3|-m-2-4)
  [fromarr]
  (@-1-3-1) edge node[above, level_2]{\textbf{↓} Severidad } ++ (left:4cm)
  (@-1-3-2) edge node[above, level_2]{\textbf{↓} Acuerdos } ++ (right:4.5cm)

  % The Cause 4 arrows
  (m-3-1) edge[xslant=.5]
    coordinate[pos=.3]   (@-3-1-1)
    coordinate[pos=.45]   (@-3-1-2)
    coordinate[pos=.65]   (@-3-1-3)
    coordinate[near end] (@-3-1-4) (m-3-1|-m-2-4)
  [fromarr]
  (@-3-1-1) edge node[above, level_2]{Alto } ++ (left:4cm)
  (@-3-1-2) edge node[above, level_2]{Precio } ++ (right:4cm)
  (@-3-1-3) edge node[above, level_2]{Baja } ++ (left:4.5cm)
  (@-3-1-4) edge node[above, level_2]{Operación} ++ (right:4cm)
  
 

   % The Cause 6 arrows
  (m-3-3) edge[xslant=.5]
    coordinate[pos=.3]   (@-3-3-3)
    coordinate[pos=.5]   (@-3-3-2)
    coordinate[near end] (@-3-3-1) (m-3-3|-m-2-4)
  [fromarr]
  (@-3-3-1) edge node[above, level_2]{Nivel } ++ (left:4cm)
  (@-3-3-2) edge node[above, level_2]{Nivel } ++ (right:4cm)
  (@-3-3-3) edge node[above, level_2]{Presión } ++ (left:4cm);
\end{tikzpicture}
\end{document}
 

答案1

利用这个库可以使用rotating包找到解决方案:

遵循正确的代码:

\documentclass[11pt,a4paper]{report}

\usepackage{rotating}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes.geometric,positioning,matrix}


\tikzset{
  ishikawa/.style={align=center, inner sep=0pt},
  matter/.style  ={rectangle, minimum size=6mm, very thick, draw=red!70!black!40,
    top color=white, bottom color=red!50!black!20, font=\itshape},
  level_1/.style ={ellipse, node distance=60pt, minimum size=6mm, very thick,
    draw=red!50!black!50, top color=white, bottom color=red!50!black!20, font=\itshape},
  level_2/.style={rectangle, minimum size=6mm, font=\itshape, font=\scriptsize}}
\tikzset{
  rows/.style 2 args={@/.style={row ##1/.style={#2}},@/.list={#1}},
  cols/.style 2 args={@/.style={column ##1/.style={#2}},@/.list={#1}},
}
\begin{document}
\begin{sidewaysfigure}[t]
    \centering  
    \begin{tikzpicture}
    \matrix[
      matrix of nodes,
      row sep=3cm,
      column sep=1cm,
      rows={1,3}{nodes=level_1},
      rows={2}{nodes=matter,anchor=center}
    ] (m) {
    Title 1 &  & Title 2 & \\
             &         &             & Effect \\
    Title 3  &   & Title 4     & \\
    };
    \path[very thick,
      toarr/.style={->, shorten <=+0pt, shorten >=+.1cm},
      fromarr/.style={<-, shorten >=+0pt, shorten <=+.1cm}]
    
      % Mid left to right arrow
      [toarr]
      (m-1-1|-m-2-4) edge (m-2-4)
    
      % The Cause 1 arrows
      (m-1-1) edge[xslant=-.5]
        coordinate[pos=.3]   (@-1-1-1)
        coordinate[pos=.45]   (@-1-1-2)
        coordinate[pos=.65]   (@-1-1-3)
        coordinate[near end] (@-1-1-4) (m-1-1|-m-2-4)
      [fromarr]
      (@-1-1-1) edge node[above, level_2]{\textbf{↓} Subtitle} ++ (left:2 cm)
      (@-1-1-2) edge node[above, level_2]{\textbf{↓} subtitle} ++ (right:2 cm)
       (@-1-1-3) edge node[above, level_2]{subtitle} ++ (left:2 cm)
      (@-1-1-4) edge node[above, level_2]{\textbf{\textbf{↓}} subtitle} ++ (right:2 cm)
      
     
      % The Cause 3 arrows
      (m-1-3) edge[xslant=-.5]
        coordinate[pos=.3]   (@-1-3-1)
        coordinate[near end] (@-1-3-2) (m-1-3|-m-2-4)
      [fromarr]
      (@-1-3-1) edge node[above, level_2]{\textbf{↓} subtitle} ++ (left:2 cm)
      (@-1-3-2) edge node[above, level_2]{\textbf{↓} subtitle} ++ (right:2 cm)
    
      % The Cause 4 arrows
      (m-3-1) edge[xslant=.5]
        coordinate[pos=.3]   (@-3-1-1)
        coordinate[pos=.45]   (@-3-1-2)
        coordinate[pos=.65]   (@-3-1-3)
        coordinate[near end] (@-3-1-4) (m-3-1|-m-2-4)
      [fromarr]
      (@-3-1-1) edge node[above, level_2]{subtitle} ++ (left:2 cm)
      (@-3-1-2) edge node[above, level_2]{subtitle} ++ (right:2 cm)
      (@-3-1-3) edge node[above, level_2]{subtitle} ++ (left:2 cm)
      (@-3-1-4) edge node[above, level_2]{subtitle} ++ (right:2 cm)
      
     
    
       % The Cause 6 arrows
      (m-3-3) edge[xslant=.5]
        coordinate[pos=.3]   (@-3-3-3)
        coordinate[pos=.5]   (@-3-3-2)
        coordinate[near end] (@-3-3-1) (m-3-3|-m-2-4)
      [fromarr]
      (@-3-3-1) edge node[above, level_2]{subtitle} ++ (left:2cm)
      (@-3-3-2) edge node[above, level_2]{subtitle} ++ (right:2cm)
      (@-3-3-3) edge node[above, level_2]{subtitle} ++ (left:2cm);
    \end{tikzpicture}
\caption{Diagrama Causa Efecto.}
\label{fig:diagrama_pescado}
\end{sidewaysfigure}

\end{document}

相关内容