树共享节点

树共享节点

我想合并 4 级节点,并将生成的单个节点与 1 级上的单个节点对齐(以获得更多对称性)。

这里这里似乎没有回答我的问题。

在此处输入图片描述

平均能量损失

\documentclass{standalone}
        \usetikzlibrary{
    fit,
    trees,
}

\begin{document}
\begin{tikzpicture}[
        level distance=1.5cm,align=center,
        level 1/.style={sibling distance=6cm,text width=3cm},
        level 2/.style={level 1,sibling distance=3cm},
        level 3/.style={level 2},
        level 4/.style={level 2},
    ]
    \node {Instruments} 
    child {node {Cash}
        child {node {Spot}
            child {node {\'Echange \\ Immédiat}
                child {node {Directement investissable}
                }
            }
        }
    }
    child {node (derivative) {Dérivés}
        child {node (term) {Terme}
            child {node (termdes) {\'Echange à \\ une date future}
            }
        }
        child {node (swap) {Swap}
            child {node (swapdes) {\'Echange de flux futurs suivant un calendrier}    
                child {node {Directement investissable} %% I create a child here for the example but I would actually have the fit area linked to the one child on level 4
                }
            }
        }
        child {node (option) {Option}
            child {node (optiondes){Variabilité future du sous-jacent}    
            }
        }
    };

    \node [fit=(termdes)(derivative)(swapdes.south)(optiondes),draw,dashed,rounded corners=5pt,fill=blue,opacity=0.2,label=right:Repackaging ]{};

\end{tikzpicture}
\end{document}

答案1

可能像这样吗?

\documentclass[tikz]{standalone}
\usetikzlibrary{
    fit,
    trees,
}

\begin{document}
\begin{tikzpicture}[
        level distance=1.5cm,align=center,
        level 1/.style={sibling distance=6cm,text width=3cm},
        level 2/.style={level 1,sibling distance=3cm},
        level 3/.style={level 2},
        level 4/.style={level 2,level distance=2.5cm},
    ]
    \node (ins){Instruments} 
    child {node {Cash}
        child {node {Spot}
            child {node(EI) {\'Echange \\ Imm\'ediat}
%                 child {node {Directement investissable}
%                 }
            }
        }
    }
    child {node (derivative) {D\'eriv\'es}
        child {node (term) {Terme}
            child {node (termdes) {\'Echange \'a \\ une date future}
                child {node(DI) {Directement investissable} %% I create a child here for the example but I would actually have the fit area linked to the one child on level 4
                }
            }
        }
        child {node (swap) {Swap}
            child {node (swapdes) {\'Echange de flux futurs suivant un calendrier}    
            }
        }
        child {node (option) {Option}
            child {node (optiondes){Variabilit\'e future du sous-jacent}    
            }
        }
    };

    \node [fit=(termdes)(derivative)(swapdes.south)(optiondes),draw,dashed,rounded corners=5pt,fill=blue,opacity=0.2,label=right:Repackaging ]{};
    \draw (DI) edge (EI) edge (swapdes) edge (optiondes);
\end{tikzpicture}
\end{document}

在此处输入图片描述

或者

\documentclass[tikz]{standalone}
\usetikzlibrary{
    fit,
    trees,
}

\begin{document}
\begin{tikzpicture}[
        level distance=1.5cm,align=center,
        level 1/.style={sibling distance=6cm,text width=3cm},
        level 2/.style={level 1,sibling distance=3cm},
        level 3/.style={level 2},
        %level 4/.style={level 2,level distance=2.5cm},
    ]
    \node (ins){Instruments} 
    child {node {Cash}
        child {node {Spot}
            child {node(EI) {\'Echange \\ Imm\'ediat}
%                 child {node {Directement investissable}
%                 }
            }
        }
    }
    child {node (derivative) {D\'eriv\'es}
        child {node (term) {Terme}
            child {node (termdes) {\'Echange \'a \\ une date future}
%                 child {node(DI) {Directement investissable} %% I create a child here for the example but I would actually have the fit area linked to the one child on level 4
%                 }
            }
        }
        child {node (swap) {Swap}
            child {node (swapdes) {\'Echange de flux futurs suivant un calendrier}    
            }
        }
        child {node (option) {Option}
            child {node (optiondes){Variabilit\'e future du sous-jacent}    
            }
        }
    };
    \path (current bounding box.south) node[below=1cm,text width=3cm]
        (DI) {Directement investissable};
    \node [fit=(termdes)(derivative)(swapdes.south)(optiondes),draw,dashed,rounded corners=5pt,fill=blue,opacity=0.2,label=right:Repackaging ]{};
    \draw (DI) edge (EI) edge (termdes) edge (swapdes) edge (optiondes);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容