以下のページも参照:
In [1]:
%gnuplot inline svg size 640,640 fixed enhanced font ',14'
In [2]:
x(u)=cos(2*pi*u)
y(u)=sin(2*pi*u)
yp(u)=(y(u)>=0) ? y(u):1/0
ym(u)=(y(u)<=0.1) ? y(u):1/0
z(u)=0.1*u
In [3]:
reset
set xrange [-2:2]
set yrange [-2:2]
unset xtics
unset ytics
unset ztics
unset border
set xyplane 0
set zeroaxis
set samples 1000
set palette defined (0 "dark-blue" , 1 "cyan")
unset colorbox
uini = -0.25
uend = 5.25
set parametric
set urange [uini:uend]
splot "++" using (x(u)):(yp(u)):(z(u)):(y(u)) \
w l lw 5 lc palette notitle
Out[3]:
In [4]:
# 磁場ベクトルの始点
set print "jiba.txt"
print -1.6,0, 0
print -0.8,0, 0
print 0, 0, 0
print 0.8,0, 0
print 1.6, 0, 0
set print
replot "jiba.txt" u 1:2:3:(0):(0):(0.55) \
w vec head filled lw 10 lc "light-green" title "磁場 B"
In [5]:
replot "++" using (x(u)):(ym(u)):(z(u)):(y(u)) \
w l lw 5 lc palette title "荷電粒子の軌道"
In [6]:
# 運動方向を表す矢印
set print "yajirushi.txt"
print x(uend),y(uend),z(uend),-0.2,0,0.001,y(uend)
set print
replot "yajirushi.txt" \
w vec head filled size 0.08, 15 lw 5 lc palette notitle