智能图表的颜色和箭头方向

智能图表的颜色和箭头方向

我希望框 A、C、D 和 E 与框 B 具有相同的颜色。我还希望 A 和 E 之间的箭头从 E 指向 A。我还希望从 B 到 A 的箭头为蓝色。以下是我从中采用的 MWEsmartdiagram 表格内部添加节点

 \documentclass[12pt,a4paper,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[rgb]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadows}
\usetikzlibrary{mindmap,arrows}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}

\begin{document}
    \definecolorseries{colours}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}
    \resetcolorseries[12]{colours}
    \smartdiagramset{%
        back arrow disabled=true,
        module minimum width=4cm,
        module minimum height=4cm,
        module x sep=5cm,
        text width=4cm,
        arrow style=<-,
        additions={
            additional item offset=1cm,
            additional item fill color=orange!36,
            additional item border color=blue,
            additional arrow color=blue,
            additional item width=4cm,
            additional item height=4cm,
            additional item text width=4cm,
            additional item bottom color=orange!36,
            additional item shadow=drop shadow,
        }
    }
    \vspace*{50mm}
    \newsavebox\outputbox
    \sbox\outputbox{%
        \begin{tabular}{c}
            E \\ \hline
            
        \end{tabular}%
    }
    \smartdiagramadd[flow diagram:horizontal]{
        \begin{tabular}{c}
            B \\ \hline
            \\
            \\
            \\
        \end{tabular}, A
    }{%
        below of module2/ \usebox\outputbox,
        right of module2/\underline{D}, above of module2/C
    }
    \smartdiagramconnect{->}{module2/additional-module1}        \smartdiagramconnect{->}{additional-module2/module2}
    \smartdiagramconnect{->}{additional-module3/module2}
\end{document}

答案1

您可以执行以下操作:

\documentclass[12pt,a4paper]{report}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}

\begin{document}
    \smartdiagramset{%
        back arrow disabled=true,
        module minimum width=4cm,
        module minimum height=4cm,
        module x sep=5cm,
        text width=4cm,
        arrow style=<-,
        uniform arrow color=true,
        arrow color=blue,
        uniform color list={red!50 for 2 items},
        additions={
            additional item offset=1cm,
            additional item border color=blue,
            additional arrow color=blue,
            additional item width=4cm,
            additional item height=4cm,
            additional item text width=4cm,
            additional item bottom color=red!50,
            additional item shadow=drop shadow,
        }
    }
    \vspace*{50mm}
    \newsavebox\outputboxx
    \sbox\outputboxx{%
        \begin{tabular}{c}
            E \\ \hline
            
        \end{tabular}%
    }
    \smartdiagramadd[flow diagram:horizontal]{
        \begin{tabular}{c}
            B \\ \hline
            \\
            \\
            \\
        \end{tabular}, A
    }{%
        below of module2/\usebox\outputboxx,
        right of module2/\underline{D}, above of module2/C
    }
    \smartdiagramconnect{<-}{module2/additional-module1}        
    \smartdiagramconnect{->}{additional-module2/module2}
    \smartdiagramconnect{->}{additional-module3/module2}
\end{document}

在此处输入图片描述

但是,A 和 B 之间的距离与其他框之间的距离不同,并且框 C、D 和 E 有蓝色边框。我不确定您是否希望这样。


我认为使用 Ti 直接绘制这个至少同样容易Z 也使得精确定位事物变得更容易(同时具有尽可能多的灵活性):

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, shadows}

\begin{document}
    \begin{tikzpicture}[
        mybox/.style={
            minimum width=4cm,
            minimum height=4cm,
            rounded corners,
            draw=gray,
            top color=red!0,
            bottom color=red!50,
            drop shadow,
        },
        myconnect/.style={
            -latex,
            ultra thick,
            blue,
        }]

        \node[mybox] at (0,0) (A) {
            A
        };

        \node[mybox, left=7.5mm of A] (B) {
            \begin{tabular}{c}
                B \\ \hline
                \\
                \\
                \\
            \end{tabular}
        };

        \node[mybox, above=7.5mm of A] (C) {
            C
        };

        \node[mybox, right=7.5mm of A] (D) {
            \underline{D}
        };

        \node[mybox, below=7.5mm of A] (E) {
            \begin{tabular}{c}
                E \\ \hline
            \end{tabular}
        };
    
        \draw[myconnect] (B) -- (A);        
        \draw[myconnect] (C) -- (A);        
        \draw[myconnect] (D) -- (A);        
        \draw[myconnect] (E) -- (A);        
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容