玖叶教程网

前端编程开发入门

动态蜘蛛图GIF(蜘蛛gif忽然吓人图)

使用Gnuplot绘制蜘蛛图,并保存为GIF动图。


#set terminal pngcairo enhanced font "arial,10" fontscale 1.0 size 600, 400 #transparent

#set output 'spiderplot.7.png'

#静态图片例子取自Gnuplot官网。

set term gif size 800,800

set term gif animate delay 5 #设置图片之间延时(单位为ms)

set output "spider.gif" #输出的文件名

unset border

set grid nopolar

set grid noxtics nomxtics noytics nomytics noztics nomztics nortics nomrtics \

nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics

set grid back linecolor rgb "grey" linewidth 0.500 dashtype solid, linecolor rgb "grey" linewidth 0.500 dashtype solid

set key fixed right top vertical Right reverse enhanced noautotitle nobox

set spiderplot

set style spiderplot linewidth 1.000 dashtype solid pointtype 6 pointsize 2.000

set style spiderplot fillstyle transparent solid 0.20 border

set size ratio 1 1,1

set style data spiderplot

unset xtics

unset ytics

unset ztics

unset cbtics

unset rtics

set paxis 1 tics axis in scale 1,0.5 nomirror norotate autojustify

set paxis 1 tics norangelimit autofreq font ",9"

set paxis 2 tics axis in scale 1,0.5 nomirror norotate autojustify

set paxis 2 tics norangelimit autofreq font ",9"

set paxis 3 tics axis in scale 1,0.5 nomirror norotate autojustify

set paxis 3 tics norangelimit autofreq font ",9"

set paxis 4 tics axis in scale 1,0.5 nomirror norotate autojustify

set paxis 4 tics norangelimit autofreq font ",9"

set paxis 5 tics axis in scale 1,0.5 nomirror norotate autojustify

set paxis 5 tics norangelimit autofreq font ",9"

set paxis 6 tics axis in scale 1,0.5 nomirror norotate autojustify

set paxis 6 tics norangelimit autofreq

unset paxis 7 tics

unset paxis 8 tics

unset paxis 9 tics

unset paxis 10 tics

set title "To plot from 2 different files or arrays, use 'newspiderplot'"

set xrange [ * : * ] noreverse writeback

set x2range [ * : * ] noreverse writeback

set yrange [ * : * ] noreverse writeback

set y2range [ * : * ] noreverse writeback

set zrange [ * : * ] noreverse writeback

set cbrange [ * : * ] noreverse writeback

set rrange [ * : * ] noreverse writeback

set paxis 1 range [ 0.00000 : 100.000 ] noextend

set paxis 1 label "Scale 1"

set paxis 1 label font "" textcolor lt -1 norotate

set paxis 2 range [ 0.00000 : 100.000 ] noextend

set paxis 2 label "Scale 2"

set paxis 2 label font "" textcolor lt -1 norotate

set paxis 3 range [ 0.00000 : 100.000 ] noextend

set paxis 3 label "Scale 3"

set paxis 3 label font "" textcolor lt -1 norotate

set paxis 4 range [ 0.00000 : 100.000 ] noextend

set paxis 4 label "Scale 4"

set paxis 4 label font "" textcolor lt -1 norotate

set paxis 5 range [ 0.00000 : 100.000 ] noextend

set paxis 5 label "Scale 5"

set paxis 5 label font "" textcolor lt -1 norotate

set paxis 6 range [ 0.00000 : 100.000 ] noextend

set paxis 6 label "Scale 6"

set paxis 6 label font "" textcolor lt -1 norotate

set paxis 7 range [ 0.00000 : 100.000 ] noextend

set paxis 8 range [ 0.00000 : 100.000 ] noextend

set paxis 9 range [ 0.00000 : 100.000 ] noextend

set paxis 10 range [ 0.00000 : 100.000 ] noextend

NO_ANIMATION = 1

#以下为循环部分,共101帧:

N=100

do for [i=0:N]{

array Array1[6] = [15*(i/50.),75,20,43*(i/50.),90,50]

array Array2[6] = [25*(i/50.),25,50,50*(i/50.),75,50]

##更新 label 1 以显示 i 的变化

set label 1 sprintf("value*(i/50), with i=%i",i) at graph 0.01,0.9 font "Arial, 23"

## Last datafile plotted: "@@"

plot keyentry with spiderplot lc 3 lw 3 title "Array #1",\

for [i=1:|Array1|] Array1 using (Array1[i]) lc 3 lw 3 title sprintf("Scale %d",i),\

newspiderplot, keyentry with spiderplot lc 4 lw 2 title "Array #2",\

for [j=1:|Array2|] Array2 using (Array2[j]) lc 4 lw 2 notitle

}

set output

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言