我怎样才能在 3D 图表中添加点?我无法添加对角点,斜率不同

我怎样才能在 3D 图表中添加点?我无法添加对角点,斜率不同

在此处输入图片描述

我正在尝试制作他的图表。但我意识到 \diagdots 不起作用,因为 的斜率不同\arrow{dr}

你能帮我么?

答案1

您可以直接使用dash patterns

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzcd}[every arrow/.append style={dash},
    column sep=1em,
    every label/.append style=black,
    /tikz/every even row/.style={nodes={xshift=4em,red!80}},
    /tikz/column 3/.style={column sep=3em},
    execute at end picture={
    \path foreach \Y [count=\X] in {\vphantom{1},1,2,n}
    { (\tikzcdmatrixname-1-\X) 
    edge[cyan,"$\phi_{\Y}$"'{black}] (\tikzcdmatrixname-3-\X)};
    \path[red!80!black] 
    (\tikzcdmatrixname-3-1)--(\tikzcdmatrixname-4-1) coordinate[pos=0](aux0)
     coordinate[pos=1](aux1)
    let \p1=($(aux1)-(aux0)$),  \n1={sqrt(\x1*\x1+\y1*\y1)} in
    [dash pattern=on \n1/3 off 2*\n1/27 on \n1/27 off \n1/27 on \n1/27 off \n1/27 on
    \n1/27 off 2*\n1/27 on \n1/3]
     foreach \X in {1,...,4}
      {(\tikzcdmatrixname-3-\X) edge (\tikzcdmatrixname-4-\X)};
    \path[red!80!black] 
    (\tikzcdmatrixname-1-1)--(\tikzcdmatrixname-2-1) coordinate[pos=0](aux0)
     coordinate[pos=1](aux1)
    let \p1=($(aux1)-(aux0)$),
    \n1={sqrt(\x1*\x1+\y1*\y1)} in
    [dash pattern=on \n1/3 off 2*\n1/27 on \n1/27 off \n1/27 on \n1/27 off \n1/27 on
    \n1/27 off 2*\n1/27 on \n1/3]
     foreach \X in {1,...,4}
      {(\tikzcdmatrixname-1-\X) edge (\tikzcdmatrixname-2-\X)};
    \path 
      foreach \X in {1,...,4}
      {foreach \Y in {1,...,2}
      {(\tikzcdmatrixname-\X-\Y) edge (\tikzcdmatrixname-\X-\the\numexpr\Y+1)}};
    \path   
    (\tikzcdmatrixname-1-3)--(\tikzcdmatrixname-1-4) coordinate[pos=0](aux0)
     coordinate[pos=1](aux1) 
     let \p1=($(aux1)-(aux0)$), \n1={sqrt(\x1*\x1+\y1*\y1)} in
       [dash pattern=on \n1/3 off 2*\n1/27 on \n1/27 off \n1/27 on \n1/27 off \n1/27 on
    \n1/27 off 2*\n1/27 on \n1/3] foreach \X in {1,...,4} 
    {(\tikzcdmatrixname-\X-3) edge (\tikzcdmatrixname-\X-4)};  
    \path foreach \Y [count=\X] in {\vphantom{1},1,2,n}
    {(\tikzcdmatrixname-2-\X) 
    edge[cyan,"$\widetilde{\phi}_{\Y}$" '{black}] (\tikzcdmatrixname-4-\X)};
    }]
 X_G & 
    X_{G_1}  & 
    X_{G_2}  & 
    X_{G_n} \\[2em] 
 X_G^m & X_{G^m_1}  & X_{G^m_2} &  X_{G^m_n} \\ 
 X_H & X_{H_1}  & X_{H_2} & X_{H_n} \\[2em] 
 X_H^m & X_{H^m_1}  & X_{H^m_2} &  X_{H^m_n} \\ 
\end{tikzcd}
\end{document}

在此处输入图片描述

或者使用decorations.markings(参见Henri 的评论),而是附带的版本tikz-cd

 \arrow[r,"\cdots"{marking,fill=white}]

最终的代码看起来确实更简单。

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[every arrow/.append style={preaction={draw,white,line width=3pt},dash,thin},
    column sep=1em,
    every label/.append style=black,
    /tikz/every even row/.style={nodes={xshift=4em,red!80}},
    /tikz/column 3/.style={column sep=3em},]
 X_G \arrow[r] \arrow[dd,"\phi"',cyan] \arrow[d,"\cdots"{marking,fill=white,text=red!80!black},red!80!black]&
    X_{G_1} \arrow[r]\arrow[dd,"\phi_1"',cyan] \arrow[d,"\cdots"{marking,fill=white,text=red!80!black},red!80!black]&
    X_{G_2} \arrow[dd,"\phi_2"',cyan]\arrow[d,"\cdots"{marking,fill=white,text=red!80!black},red!80!black] \arrow[r,"\cdots"{marking,fill=white}] &
    X_{G_n} \arrow[dd,"\phi_n"',cyan]\arrow[d,"\cdots"{marking,fill=white,text=red!80!black},red!80!black]  \\[2em] 
 X_G^m \arrow[r]&
    X_{G^m_1}\arrow[r]    &
    X_{G^m_2} \arrow[r,"\cdots"{marking,fill=white}] &
     X_{G^m_n} \\ 
 X_H  \arrow[r]\arrow[d,"\cdots"{marking,fill=white,text=red!80!black},red!80!black]&
    X_{H_1} \arrow[r] \arrow[d,"\cdots"{marking,fill=white,text=red!80!black},red!80!black] &
    X_{H_2}  \arrow[r,"\cdots"{marking,fill=white}]\arrow[d,"\cdots"{marking,fill=white,text=red!80!black},red!80!black]&
    X_{H_n}  \arrow[d,"\cdots"{marking,fill=white,text=red!80!black},red!80!black]\\[2em] 
 X_H^m \arrow[r]\arrow[uu,"\widetilde{\phi}",cyan]&
    X_{H^m_1}\arrow[r] \arrow[uu,"\widetilde{\phi}_1",cyan]  &
    X_{H^m_2}\arrow[r,"\cdots"{marking,fill=white}]\arrow[uu,"\widetilde{\phi}_2",cyan] &
     X_{H^m_n} \arrow[uu,"\widetilde{\phi}_n",cyan]\\ 
\end{tikzcd}
\end{document}

在此处输入图片描述

编辑:通过预动作在路径上添加白色光晕,稍微增强了 3d 效果。

在此处输入图片描述

相关内容