图 Linus Pauling tikz

图 Linus Pauling tikz

我正在尝试在 tikz 中绘制 Linus Pauling 图表,有可能绘制箭头示例图片模型图

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \tikzset{dot/.style={fill=orange!20,circle}}
    \tikzset{set/.style={<-,red}}
    \foreach\l[count=\c] in {Q,P,...,K}
    {
        \draw[dotted] (0,\c) -- (5.0, \c);
        \node at (-1.0, \c){\bfseries\l};
    }
    
    \foreach\n[count=\y] in {7,...,1}
    {
        \draw[dotted] (0,\y) -- (5.0,\y);
        \node at (-0.5,\y){\bfseries\n};
    }
    
    \foreach \x in {1,2,...,4}
    {
        \draw[dotted] (\x,0) -- (\x,8);
        \node at (\x,-0.5){\x};
    }
%%% Arrow 
   \draw[set] (0.5,6.5)--(1.5,7.5);
    \draw[set] (0.5,5.5)--(1.5,6.5);
    \draw[set] (0.5,4.5)--(2.5,6.5);
    %%%%% S %%%
    \node[dot] (1) at (1,7){1s};
    \node[dot] (2) at (1,6){2s};
    \node[dot] at (1,5){3s};
    \node[dot] at (1,4){4s};
    \node[dot] at (1,3){5s};
    \node[dot] at (1,2){6s};
    \node[dot] at (1,1){7s};
    %%%%% Block p
    \node[dot] at (2,6){2p};
    \node[dot] at (2,5){3p};
    \node[dot] at (2,4){4p};
    \node[dot] at (2,3){5p};
    \node[dot] at (2,2){6p};
    %\node[dot] at (2,1){};
    %%%%% Block d
    \node[dot] at (3,5){3d};
    \node[dot] at (3,4){4d};
    \node[dot] at (3,3){4d};
    \node[dot] at (3,2){6p};
    %%%%% Block f
    \node[dot] at (4,4){4f};
    \node[dot] at (4,3){5f};    
\end{tikzpicture}
\end{document}

答案1

也许是这样的:

莱纳斯·鲍林图

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,decorations.markings,arrows.meta}
\begin{document}
      
\begin{tikzpicture}[x=2cm,y=2cm]
    \tikzset{%
            dot/.style={fill=orange!20,circle},
            gdot/.style={fill=violet!20,circle},
            set/.style={postaction={decorate,decoration={
        markings,
        mark=at position .5 with {\arrow[red]{Stealth}}
      }}}}
    \foreach\l[count=\c] in {Q,P,...,K}
    {
        \draw[dotted] (0,\c) -- (5.0, \c);
        \node at (-1.0, \c){\bfseries\l};
    }
    
    \foreach\n[count=\y] in {7,...,1}
    {
        \draw[dotted] (0,\y) -- (5.0,\y);
        \node at (-0.5,\y){\bfseries\n};
    }
    
    \foreach \x in {1,2,...,4}
    {
        \draw[dotted] (\x,0) -- (\x,8);
        \node at (\x,-0.5){\x};
    }

    %%%%% S %%%
    \node[dot] (1) at (1,7){1s};
    \node[dot] (2s) at (1,6){2s};
    \node[dot] (3s) at (1,5){3s};
    \node[dot] (4s)at (1,4){4s};
    \node[dot] (5s) at (1,3){5s};
    \node[dot] (6s) at (1,2){6s};
    \node[dot] (7s) at (1,1){7s};
    %%%%% Block p
    \node[gdot] (2p) at (2,6){2p};
    \node[gdot] (3p) at (2,5){3p};
    \node[gdot] (4p) at (2,4){4p};
    \node[gdot] (5p) at (2,3){5p};
    \node[gdot] (6p) at (2,2){6p};
    \node[gdot] (7p) at (2,1){7p};
    %\node[dot] at (2,1){};
    %%%%% Block d
    \node[dot] (3d) at (3,5){3d};
    \node[dot] (4d) at (3,4){4d};
    \node[dot] (5d) at (3,3){5d};
    \node[dot] (6d) at (3,2){6d};
    %%%%% Block f
    \node[gdot] (4f) at (4,4){4f};
    \node[gdot] (5f) at (4,3){5f};   
    
    \draw (1) edge [set,out=-135,in=45,looseness=6] (2s); 
    \draw (2s) edge [set,out=-135,in=45,looseness=5] (2p);
    \draw [red] (2p) -- (3s);
    \draw (3s) edge [set,out=-135,in=45,looseness=5] (3p); 
    \draw[red] (3p)--(4s);
    \draw (4s) edge [set,out=-135,in=45,looseness=3] (3d); 
    \draw[red] (3d)--(4p) (4p) -- (5s);
    \draw (5s) edge [set,out=-135,in=45,looseness=3] (4d);
    \draw[red] (4d)--(5p) (5p) -- (6s);
    \draw (6s) edge [set,out=-135,in=45,looseness=2.5] (4f);
    \draw[red] (4f) -- (5d) (5d) -- (6p) (6p) -- (7s);
    \draw (7s) edge [set,out=-135,in=45,looseness=2.5] (5f);
    \draw[red] (5f) -- (6d) (6d) -- (7p) (7p) edge[red,-Stealth]++ (-.5,-.5);
    
    
\end{tikzpicture}
\end{document}

我没有更改代码中的任何相关内容,但您可以利用相对寻址(即一个依赖于另一个)放置节点,而不是提供绝对坐标。我只需要将比例加倍,以便在节点之间留出更多空间。

编辑:另一张(更好的?)图表

我决定做点别的。我想找点更自动化的东西,但最后却找到了手动的沿着节点绘制图形。但无论如何,你会发现它更有吸引力。

莱纳斯·鲍林 V2

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.pathreplacing,decorations.markings,arrows.meta}

\tikzset{%
    adot/.style={fill=orange!20,circle,minimum width=.8cm},
    bdot/.style={fill=violet!20,circle,minimum width=.8cm},
        % Arrow color
    arrcol/.style={violet},
        % No arrow
    narr/.style={violet,line width=1.5pt},
        % Arrow in the middle
    marr/.style={narr,postaction={decorate,decoration={
        markings,
        mark=at position 0.5 with {\arrow[arrcol]{Stealth[scale=1]}}
      }}},
      % Arrow at the begining
    barr/.style={narr,postaction={decorate,decoration={
        markings,
        mark=at position 0.05 with {\arrow[arrcol]{Stealth[scale=1]}}
      }}}
    }
            
\begin{document}
      
    \begin{tikzpicture}
        \def\d{2} % Node distance
        \path (0,0)
            node[adot] (1-s) {1s} 
            \foreach \i in {2,...,7}
                {--++ (0,-\d) node[adot] (\i-s) {\i s} coordinate[midway](\i-1)};
        \path (\d,-\d)
            node[bdot] (2-p) {2p} 
            \foreach \i in {3,...,7}
                {--++ (0,-\d) node[bdot] (\i-p) {\i p} coordinate[midway](\i-2)};
        \path (2*\d,-2*\d)
            node[adot] (3-d) {3d} 
            \foreach \i in {4,...,6}
                {--++ (0,-\d) node[adot] (\i-d) {\i d} coordinate[midway](\i-3)};
        \path (3*\d,-3*\d)
            node[bdot] (4-f) {4f} --++ (0,-\d) node[bdot] (5-f) {5f} coordinate[midway](5-4);
        
        
        \path (7-s) --++ (0,-.5*\d) coordinate (8-1);
        \path (7-p) --++ (0,-.5*\d) coordinate (8-2);
        \path (6-d) --++ (0,-.5*\d) coordinate (7-3);
        \path (5-f) --++ (0,-.5*\d) coordinate (6-4);
        
        \path (2-p) --++ (0,.5*\d) coordinate (2-2);
        \path (3-d) --++ (0,.5*\d) coordinate (3-3);
        \path (4-f) --++ (0,.5*\d) coordinate (4-4);
 
% Uncomment to see intermediate coordinate      
%       \foreach \i in {2,...,8} \node at (\i-1) {\i-1};
%       \foreach \i in {2,...,8} \node at (\i-2) {\i-2};
%       \foreach \i in {3,...,7} \node at (\i-3) {\i-3};
%       \foreach \i in {4,...,6} \node at (\i-4) {\i-4};
        

            \draw[narr] (1-s) --++ (1,1);
            \path   (1-s) edge [narr,out=-135,in=-135,looseness=3] (2-1)
                    (2-1) edge [barr,out=45,in=45,looseness=3] (2-s)
                    
                    (2-s) edge [narr,out=-135,in=-135,looseness=3] (3-1)
                    (3-1) edge [barr] (2-2) 
                    (2-2) edge [barr,out=45,in=45,looseness=3] (2-p)
                    (2-p) edge [narr] (3-s)
                    
                    (3-s) edge [narr,out=-135,in=-135,looseness=3] (4-1)
                    (4-1) edge [barr] (3-2) 
                    (3-2) edge [barr,out=45,in=45,looseness=3] (3-p)
                    (3-p) edge [narr] (4-s)
                    
                    (4-s) edge [narr,out=-135,in=-135,looseness=3] (5-1)
                    (5-1) edge [barr] (3-3)
                    (3-3) edge [barr,out=45,in=45,looseness=3] (3-d)
                    (3-d) edge [narr] (4-p)
                    (4-p) edge [narr] (5-s)
                    
                    (5-s) edge [narr,out=-135,in=-135,looseness=3] (6-1)
                    (6-1) edge [barr] (4-3)
                    (4-3) edge [barr,out=45,in=45,looseness=3] (4-d)
                    (4-d) edge [narr] (5-p)
                    (5-p) edge [narr] (6-s)
                    
                    (6-s) edge [narr,out=-135,in=-135,looseness=3] (7-1)
                    (7-1) edge [barr] (4-4)
                    (4-4) edge [barr,out=45,in=45,looseness=3] (4-f)
                    (4-f) edge [narr] (5-d)
                    (5-d) edge [narr] (6-p)
                    (6-p) edge [narr] (7-s)
                    
                    (7-s) edge [narr,out=-135,in=-135,looseness=3] (8-1)
                    (8-1) edge [barr] (5-4)
                    (5-4) edge [barr,out=45,in=45,looseness=3] (5-f)
                    (5-f) edge [narr] (6-d)
                    (6-d) edge [narr] (7-p)
                    ;
                \draw[narr,-{Stealth[scale=1]}] (7-p) --++ (-1,-1); 
    \end{tikzpicture}

\end{document}

答案2

我提供了一个稍微更紧凑的解决方案,绘制所有内部\foreach命令。

\documentclass[border=2mm]{standalone}
\usepackage{tikz}

\tikzset
{% styles for the nodes
  s/.style={fill=red!20},
  p/.style={fill=green!20},
  d/.style={fill=blue!20},
  f/.style={fill=yellow!20}
}

\begin{document}
\begin{tikzpicture}[scale=1.5, y={(0cm,-1cm)},line cap=rect]
  \foreach\y in {1,...,8}
  {%
    \ifnum\y > 1
      \draw[thick]    (0.5*\y+1.25,0.5*\y-0.75) arc (-135:45:{0.125*sqrt(2)});
    \fi
    \draw[thick,->]   (0.5*\y+1.5,0.5*\y-0.5) -- (0.5,\y+0.5);
    \ifnum \y < 8
      \draw[thick,->] (0.5,\y+0.5) arc (225:45:{0.125*sqrt(2)}) --
                      (0.5*\y+1.75,0.5*\y-0.25);
    \fi
  }
  \foreach\y in {1,...,7}
  {%
    \pgfmathtruncatemacro\maxx{6-abs(4.5-\y)}
    \foreach[count=\x]\i in {s,p,d,f}
    {%
      \ifnum \x < \maxx
        \pgfmathtruncatemacro\ne{4*\x-2)} % number of electrons
        \draw[\i] (\x,\y) circle (0.25);
        \node  at (\x,\y) {$\y\mathrm{\i}^{\ne}$};
      \fi
   }
  }
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容