流程图和 3D 图表 tikz

流程图和 3D 图表 tikz

我正在尝试做到这一点: 在此处输入图片描述

我尝试过这个:


%CONFIGURACIÓN DEL DOCUMENTO Y HOJA

\documentclass[tikz,border=3.14pt]{standalone}
\usetikzlibrary{3d,decorations.text,shapes.arrows,positioning,fit,backgrounds}
\tikzset{pics/fake box/.style args={% #1=color, #2=x dimension, #3=y dimension, #4=z dimension
#1 with dimensions #2 and #3 and #4}{
code={
\draw[gray,ultra thin,fill=#1]  (0,0,0) coordinate(-front-bottom-left) to
++ (0,#3,0) coordinate(-front-top-right) --++
(#2,0,0) coordinate(-front-top-right) --++ (0,-#3,0) 
coordinate(-front-bottom-right) -- cycle;
\draw[gray,ultra thin,fill=#1] (0,#3,0)  --++ 
 (0,0,#4) coordinate(-back-top-left) --++ (#2,0,0) 
 coordinate(-back-top-right) --++ (0,0,-#4)  -- cycle;
\draw[gray,ultra thin,fill=#1!80!black] (#2,0,0) --++ (0,0,#4) coordinate(-back-bottom-right)
--++ (0,#3,0) --++ (0,0,-#4) -- cycle;
\path[gray,decorate,decoration={text effects along path,text={texth}}] (#2/2,{2+(#3-2)/2},0) -- (#2/2,0,0);
}
}}
% from https://tex.stackexchange.com/a/52856/121799
\tikzset{circle dotted/.style={dash pattern=on .05mm off 2mm,
                                         line cap=round}}


\begin{document}

%CONFIGURACIÓN DEL ENCABEZADO



 


%DESDE AQUÍ SE ESCRIBE TODO EL CONTENIDO

% \begin{abstract}
   
% Solution to Homework
% \end{abstract}




\begin{tikzpicture}[x={(1,0)},y={(0,1)},z={({cos(60)},{sin(60)})},
font=\sffamily\small,scale=2,roundnode/.style={circle, draw=green!60, fill=green!5, very thick, minimum size=7mm},
squarednode/.style={rectangle, draw=gray!60, fill=white!5, very thick, minimum size=7mm}, roundnode/.style={circle, draw=green!60, fill=purple!10, very thick, minimum size=7mm},  ]


\node[roundnode ] at (0.1 ,0.2,0)   (data) {$text $};
\node[squarednode ] at (0.1 ,0.9,0 )   (next4) {$text3$};

\node[squarednode ] at (0.4,0.65,0.7 )   (next2) {$text$};
\node[squarednode ] at (0.1 ,-0.5,0)   (next) {$text$};
\draw[->,very thick] (next) -- (data) ;
\draw[->,very thick] (next2) -- (next4) ;
\draw[->,very thick] (next4) -- (data) ;
%\node[draw,single arrow] at (0.7 ,0.5,0) {Text};

\foreach \X [count=\Y] in {1.6,1.4,1.2}
{
\draw pic (box1-\Y) at (\Y,-\X/2,0) {fake box=white!70!green with dimensions 0.2 and {2*\X} and 1*\X};
}
\end{tikzpicture}

   
\end{document}









结果是:

在此处输入图片描述

latex 中的矩形形状本来就很好。但我怎样才能得到第一幅图中的整个图表呢?

下一个:

  1. 使矩形上的文本不同
  2. 减少矩形之间的空间
  3. 添加大外圆

谢谢

答案1

decorations.text在循环中使用库将垂直文本放置在某个路径上\foreach(其中文本是循环的参数之一)并非易事,因为您首先需要扩展包含文本的参数。因此,您需要执行以下操作:

\foreach \l [count=\i] in {Text, TEXt} {
    \edef\textpath{
        \noexpand%
        \path[decorate, decoration={
            text effects along path, text={\l}, text align=center
        }] (\i,2) -- (\i,-2);
    }\textpath
}

以下方法展示了如何在绘图中使用它。此外,它还展示了如何将该fit库与以下库结合使用pics

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text, decorations.markings, fit, arrows.meta}

% definition of some colors
\colorlet{mygreen1}{green!50!cyan!80!black}
\colorlet{mygreen2}{yellow!80!green!80!black!50}
\colorlet{myyellow}{yellow!50!black}

% definition of the cuboid pic
\tikzset{
    pics/regular cuboid/.style={
        code={
            \tikzset{regular cuboid/.cd, #1}
            \draw[regular cuboid/front]
                (0,0) 
                coordinate (-south west) rectangle 
                (\pgfkeysvalueof{/tikz/regular cuboid/width},
                 \pgfkeysvalueof{/tikz/regular cuboid/height})
                coordinate (-north east)
                node[regular cuboid/label] 
                    {\pgfkeysvalueof{/tikz/regular cuboid/label text}};
            \draw[regular cuboid/top]
                (0,\pgfkeysvalueof{/tikz/regular cuboid/height}) 
                coordinate (-north west) -- 
                ++(\pgfkeysvalueof{/tikz/regular cuboid/depth},
                   \pgfkeysvalueof{/tikz/regular cuboid/depth})
                coordinate (-far north west) --
                ++(\pgfkeysvalueof{/tikz/regular cuboid/width},0)
                coordinate (-far north east) -- 
                (-north east) -- 
                cycle;
            \draw[regular cuboid/side]
                (\pgfkeysvalueof{/tikz/regular cuboid/width},0) 
                coordinate (-south east) -- 
                ++(\pgfkeysvalueof{/tikz/regular cuboid/depth},
                   \pgfkeysvalueof{/tikz/regular cuboid/depth}) 
                coordinate (-far south east) --
                (-far north east) -- 
                (-north east) -- 
                cycle;
            \coordinate (-north) at 
                ({0.5*\pgfkeysvalueof{/tikz/regular cuboid/width}},
                 \pgfkeysvalueof{/tikz/regular cuboid/height});
            \coordinate (-south) at 
                ({0.5*\pgfkeysvalueof{/tikz/regular cuboid/width}},0);
            \coordinate (-east) at 
                (\pgfkeysvalueof{/tikz/regular cuboid/width},
                 {0.5*\pgfkeysvalueof{/tikz/regular cuboid/height}});
            \coordinate (-west) at 
                (0,0.5*\pgfkeysvalueof{/tikz/regular cuboid/height});
        }
    },
    regular cuboid/height/.initial={1},
    regular cuboid/width/.initial={1},
    regular cuboid/depth/.initial={0.5},
    regular cuboid/label text/.initial={},
    regular cuboid/front/.style={fill=black!10},
    regular cuboid/top/.style={fill=black!10},
    regular cuboid/side/.style={fill=black!20},
    regular cuboid/label/.style={midway}
}

\begin{document}
\begin{tikzpicture}

% create the row of pics
\coordinate (box 0-south west) at (0,0);
\foreach \h/\f/\d/\l [count=\i] in {
    3cm/yellow!20/mygreen1/Text,
    3cm/yellow!20/mygreen1/TEXt,
    2.9cm/blue!20/black/Text,
    2.5cm/yellow!20/mygreen1/Text,
    2.4cm/yellow!20/mygreen1/Text,
    2.3cm/blue!10/black/Text,
    2cm/yellow!20/mygreen1/Text
} {
    % create the cuboid
    \pgfmathtruncatemacro{\lasti}{\i-1}
    \pic (box \i) at ([xshift=1.25cm]box \lasti-south west) {
        regular cuboid={
            front/.style={draw=\d,fill=\f},
            top/.style={draw=\d,fill=\f},
            side/.style={draw=\d,fill=\f!black!20},
            height={\h},
            width={0.65cm},
            depth={0.25cm}
        }
    };
    % add the vertical label
    \edef\labelpath{
        \noexpand%
        \path[decorate, decoration={
            text effects along path, text={\l}, text align=center
        }] (box \i-north) -- (box \i-south);
    }\labelpath
}

% add the last cuboid with horizontal label
\pic (box 8) at ([xshift=1.25cm]box 7-south west) {
    regular cuboid={
        front/.style={fill=mygreen2},
        top/.style={fill=mygreen2},
        side/.style={fill=mygreen2!80!black},
        width={1.33cm},
        depth={0.25cm},
        label text={Text}
    }
};

% add the surrounding frame with arrow heads
\node[draw, thick, rounded corners=0.5cm, inner xsep=0.5cm, inner ysep=1cm,
    fit={(box 1-south west) ([yshift=0.5cm]box 1-far north west) (box 8-far north east)},
    postaction={decorate, decoration={markings, 
        mark={at position 7.5cm with {\arrow{Stealth[length=10pt]}}},
        mark={at position 15.5cm with {\arrow{Stealth[length=10pt]}}},
        mark={at position 32.5cm with {\arrow{Stealth[length=10pt]}}}
    }}] 
    (frame) {};

% place some text inside the frame
\node[myyellow, font=\bfseries, anchor=west] 
    at ([yshift=1cm]box 1-north west) 
    {Some text, some text};

% add the two orange nodes at the bottom of the frame
\node[draw, fill=orange!10, rounded corners, inner sep=0.25cm, minimum width=4cm]
    at ([yshift=-1cm, xshift=4cm]box 1-south west)
    {Text};

\node[draw, fill=orange!10, rounded corners, inner sep=0.25cm, minimum width=4cm]
    at ([yshift=-1cm, xshift=8.5cm]box 1-south west)
    {Text};

% place another pic to the left
\pic (box 9) at (-4,0) {
    regular cuboid={
        front/.style={draw=mygreen1,fill=mygreen2},
        top/.style={draw=mygreen1,fill=mygreen2},
        side/.style={draw=mygreen1,fill=mygreen2!80!black},
        width={1.33cm},
        depth={0.25cm},
        label text={Text}
    }
};

% add the three nodes above and below the pic on the left
\node[draw=mygreen1, rounded corners, inner sep=0.25cm, minimum width=2cm]
    (label 1) at ([yshift=-1cm]box 9-south)
    {text};

\node[draw=mygreen1, rounded corners, inner sep=0.25cm, minimum width=2cm]
    (label 2) at ([yshift=1.5cm]box 9-north)
    {text};

\node[draw=mygreen1, rounded corners, inner sep=0.25cm, minimum width=2cm]
    (label 3) at ([yshift=1cm]label 2.north)
    {text};

% add the arrows with labels
\draw[-{Stealth[length=10pt]}, thick]
    (frame.90) -- ++(0,0.5cm) -| (label 3.north)
    node[pos=0.4, below, myyellow, font=\bfseries] {Some text};

\draw[-{Stealth[length=10pt]}, thick]
    (label 1.north) -- (box 9-south);

\draw[-{Stealth[length=10pt]}, thick]
    (label 3.south) -- (label 2.north);

\draw[-{Stealth[length=10pt]}, thick]
    (label 2.south) -- (box 9-north |- box 9-far north east);

\draw[-{Stealth[length=10pt]}, thick, myyellow]
    (box 9-west -| box 9-far north east) -- (box 9-west -| frame.west)
    node[midway, above, myyellow, font=\bfseries] {Text}
    node[midway, below, myyellow, font=\bfseries] {Text};

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容