我有一个由边缘和颜色组成的数据集,我想以类似网络的方式绘制它们,使用线条和圆圈(如下图所示),并可能使用簇着色。
数据的组织方式如下:
point1a_x point1a_y color
point1b_x point1b_y color
point2a_x point2a_y color
point2b_x point2b_y color
(...)
point2n_x point2n_y color
point2n_x point2n_y color
我将如何在 gnuplot 上进行此操作?
最佳答案
好的,所以我自己解决了这个问题,我将在这里留下详细信息,以帮助有相同问题的人。
节点上带有标签的单色图:
这将生成一个与问题中的图表非常相似的图表,其中有连接圆圈和内部标签的线。
plot 'edges.dat' u 1:2 with lines lc rgb "black" lw 2 notitle,\
'edges.dat' u 1:2:(0.6) with circles fill solid lc rgb "black" notitle,\
'edges.dat' using 1:2:($0) with labels tc rgb "white" offset (0,0) font 'Arial Bold' notitle
只需稍加改动,它就可以与问题图片上的完全匹配。
plot 'edges.dat' u 1:2 with lines lc rgb "black" lw 2 notitle,\
'edges.dat' u 1:2:(0.8) with circles linecolor rgb "white" lw 2 fill solid border lc lt 0 notitle, \
'edges.dat' using 1:2:($0) with labels offset (0,0) font 'Arial Bold' notitle
<小时/>
簇色图:
unset colorbox
set palette model RGB defined ( 0 0 0 0 , 1 1 0 0 , 2 1 0.9 0, 3 0 1 0, 4 0 1 1 , 5 0 0 1 , 6 1 0 1 )
plot 'edges.dat' u 1:2:3 with lines lc palette notitle,\
'edges.dat' u 1:2:(0.15):3 with circles fill solid palette notitle
<小时/>
所有图中使用的数据都遵循以下结构:
21.53 9.55 0
24.26 7.92 0
5.63 3.23 1
2.65 1.77 1
5.63 3.23 0
4.27 7.04 0
(...)
关于graph - 如何在 gnuplot 上绘制树/图/网络数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20406346/