这里不同的颜色代表边的不同权重,点的颜色是任意的。tex 代码:
\documentclass[aps,prl,superscriptaddress]{revtex4}
\usepackage{subfigure}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric, calc}
\usepackage[standard]{ntheorem}
\def\endproof{\vrule height6pt width6pt depth0pt}
\usepackage{color}
%%%%%%%%%%%%%%%%%%The color scheme begins
\definecolor{dsblue}{RGB}{65,105,225}
\definecolor{spgreen}{RGB}{46,139,87}
\definecolor{tored}{RGB}{220,20,60}
\definecolor{glyellow}{RGB}{218,165,32}
\definecolor{botcolor}{RGB}{119,136,153}
\definecolor{linecolor}{RGB}{128,128,128}
\definecolor{topcolor}{RGB}{0,0,139}
\tikzstyle{mypoint}=[shape=circle,draw,white,bottom color=botcolor,top color= topcolor]
\tikzstyle{myline}=[linecolor,thin]
\tikzstyle{mythick}=[thick]
%%%%%%%%%%%%%%%%%%The color scheme ends
\begin{document}
\begin{tikzpicture}[inner sep=0.55mm,scale=0.6]
\node at (0,1) [mypoint] (a10) {};
\node at (0,2) [mypoint] (a11) {};
\node at (0,3) [mypoint] (a12) {};
\node at (0,4) [mypoint] (a13) {};
\node at (0,5) [mypoint] (a14) {};
\node at (0,-1) [mypoint] (a20) {};
\node at (0,-2) [mypoint] (a21) {};
\node at (0,-3) [mypoint] (a22) {};
\node at (0,-4) [mypoint] (a23) {};
\node at (0,-5) [mypoint] (a24) {};
\node at (1,0) [mypoint] (b10) {};
\node at (2,0) [mypoint] (b11) {};
\node at (3,0) [mypoint] (b12) {};
\node at (4,0) [mypoint] (b13) {};
\node at (5,0) [mypoint] (b14) {};
\node at (-1,0) [mypoint] (b20) {};
\node at (-2,0) [mypoint] (b21) {};
\node at (-3,0) [mypoint] (b22) {};
\node at (-4,0) [mypoint] (b23) {};
\node at (-5,0) [mypoint] (b24) {};
%%%%%%%%%%%a1-b1=0=a2-b2=b2-a1,a2-b1=0,b1-a2-1=-1=4,4-4=0
\foreach \n/\m in {0/0,1/1,2/2,3/3,4/4} {
\draw [glyellow,mythick] (a1\n) -- (b1\m);
\draw [glyellow,mythick] (a2\n) -- (b2\m);
\draw [glyellow,mythick] (b2\n) -- (a1\m);
}
%%%%%%%%%%%a1-b1=-1=4=a2-b2=b2-a1,a2-b1=-1,b1-a2-1=0,4-0=4
\foreach \n/\m in {0/1,1/2,2/3,3/0} {
\draw [glyellow,mythick] (a2\n) -- (b1\m);
}
%%%%%%%%%%%a1-b1=1=a2-b2=b2-a1,a2-b1=1,b1-a2-1=-2=3,4-3=1
\foreach \n/\m in {1/0,2/1,3/2,4/3,0/4} {
\draw [spgreen,mythick] (a2\n) -- (b1\m);
\draw [tored,mythick] (a1\n) -- (b1\m);
\draw [tored,mythick] (a2\n) -- (b2\m);
\draw [tored,mythick] (b2\n) -- (a1\m);
}
%%%%%%%%%%%a1-b1=2=a2-b2=b2-a1,a2-b1=2,b1-a2-1=-3=2,4-2=2
\foreach \n/\m in {2/0,3/1,4/2,0/3} {
\draw [dsblue,mythick] (a2\n) -- (b1\m);
\draw [dsblue,mythick] (a1\n) -- (b1\m);
\draw [dsblue,mythick] (a2\n) -- (b2\m);
\draw [dsblue,mythick] (b2\n) -- (a1\m);
}
%%%%%%%%%%%a1-b1=3=a2-b2=b2-a1,a2-b1=3,b1-a2-1=-4=1,4-1=3
\foreach \n/\m in {3/0,4/1,0/2,1/3} {
\draw [tored,mythick] (a2\n) -- (b1\m);
\draw [spgreen,mythick] (a1\n) -- (b1\m);
\draw [spgreen,mythick] (a2\n) -- (b2\m);
\draw [spgreen,mythick] (b2\n) -- (a1\m);
}
\foreach \n/\m in {0/1,1/2,2/3,3/4} {
\draw [linecolor,thin] (a1\n) -- (a1\m);
\draw [linecolor,thin] (a2\n) -- (a2\m);
\draw [linecolor,thin] (b1\n) -- (b1\m);
\draw [linecolor,thin] (b2\n) -- (b2\m);
}
\node [above] at (a14) {$A_1$};
\node [below] at (a24) {$A_2$};
\node [right] at (b14) {$B_1$};
\node [left] at (b24) {$B_2$};
\end{tikzpicture}
\end{document}
答案1
关于 OP 的答案,我尝试了一些方法,比如将值编码为线条粗细,但看起来不太好看。相反,下面确实将值编码为单色值(使用浅蓝色和深蓝色),我将颜色名称重命名为语义(v1
,...,v4
我v5
认为(linecolor
可能是 - 没有值?)并设置它们的颜色。
我调整了 s 的 for 循环\node
并稍微增加了标签距离,但其余代码保持不变
\documentclass[aps,prl,superscriptaddress]{revtex4}
\usepackage{subfigure}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{shapes.geometric, calc}
\usepackage[standard]{ntheorem}
\def\endproof{\vrule height6pt width6pt depth0pt}
\usepackage{color}
%%%%%%%%%%%%%%%%%%The color scheme begins
\tikzset{% was glyellow
v1/.style={line width=.5pt,blue!33!black},
% was spgreen
v2/.style={line width=.5pt,blue!66!black},
% was tored
v3/.style={line width=.5pt,blue!33},
%was dsblue
v4/.style={line width=.5pt,blue!66},
% was linecolor (no value?)
v5/.style={line width=.5pt,black}
}
\tikzstyle{mypoint}=[shape=circle,draw,white,fill=black,label distance=2ex]
\begin{document}
\begin{tikzpicture}[inner sep=0.55mm,scale=0.6]
\foreach \a in {0,...,4} \node at (0,\a+1) [mypoint] (a1\a) {};
\foreach \a in {0,...,4} \node at (0,-\a-1) [mypoint] (a2\a) {};
\foreach \b in {0,...,4} \node at (\b+1,0) [mypoint] (b1\b) {};
\foreach \b in {0,...,4} \node at (-\b-1,0) [mypoint] (b2\b) {};
%%%%%%%%%%%a1-b1=0=a2-b2=b2-a1,a2-b1=0,b1-a2-1=-1=4,4-4=0
\foreach \n/\m in {0/0,1/1,2/2,3/3,4/4} {
\draw [v1] (a1\n) -- (b1\m);
\draw [v1] (a2\n) -- (b2\m);
\draw [v1] (b2\n) -- (a1\m);
}
%%%%%%%%%%%a1-b1=-1=4=a2-b2=b2-a1,a2-b1=-1,b1-a2-1=0,4-0=4
\foreach \n/\m in {0/1,1/2,2/3,3/0} {
\draw [v1] (a2\n) -- (b1\m);
}
%%%%%%%%%%%a1-b1=1=a2-b2=b2-a1,a2-b1=1,b1-a2-1=-2=3,4-3=1
\foreach \n/\m in {1/0,2/1,3/2,4/3,0/4} {
\draw [v2] (a2\n) -- (b1\m);
\draw [v3] (a1\n) -- (b1\m);
\draw [v3] (a2\n) -- (b2\m);
\draw [v3] (b2\n) -- (a1\m);
}
%%%%%%%%%%%a1-b1=2=a2-b2=b2-a1,a2-b1=2,b1-a2-1=-3=2,4-2=2
\foreach \n/\m in {2/0,3/1,4/2,0/3} {
\draw [v4] (a2\n) -- (b1\m);
\draw [v4] (a1\n) -- (b1\m);
\draw [v4] (a2\n) -- (b2\m);
\draw [v4] (b2\n) -- (a1\m);
}
%%%%%%%%%%%a1-b1=3=a2-b2=b2-a1,a2-b1=3,b1-a2-1=-4=1,4-1=3
\foreach \n/\m in {3/0,4/1,0/2,1/3} {
\draw [v3] (a2\n) -- (b1\m);
\draw [v2] (a1\n) -- (b1\m);
\draw [v2] (a2\n) -- (b2\m);
\draw [v2] (b2\n) -- (a1\m);
}
\foreach \n/\m in {0/1,1/2,2/3,3/4} {
\draw [v5] (a1\n) -- (a1\m);
\draw [v5] (a2\n) -- (a2\m);
\draw [v5] (b1\n) -- (b1\m);
\draw [v5] (b2\n) -- (b2\m);
}
\node [above=1ex] at (a14) {$A_1$};
\node [below=1ex] at (a24) {$A_2$};
\node [right=1ex] at (b14) {$B_1$};
\node [left=1ex] at (b24) {$B_2$};
\end{tikzpicture}
\end{document}
如果其中一个值特别令人感兴趣,也可以调整颜色以表示 3 个值(blue!50!black
、blue
和blue!50!white
以及高亮颜色)。单色方法的图像如下所示,我认为这更容易捕捉