################################################### # データの読み込みが少し面倒です. # バッチ処理は以下のように実行します. # yorick -batch plot2d.i ################################################### i=0 f = open("cos.dat","r"); while(x = rdline(f)){ i=i+1 } dim=i close,f f = open("cos.dat","r"); xr=array(double,dim); yr=array(double,dim); read,f,format="%f %f",xr,yr close,f window, 0, wait=1, style="boxed.gs"; x2=span(-2*pi,2*pi,100); sinx=sin(x2); plg, sinx, x2, marks=0, color="red", width=4.0; plmk, yr, xr, color="green", marker='\4', msize=0.7; xytitles, "X-label", "Y-label", [0.00,0.02]; pltitle, "Plot2d"; eps, "plot2d"; pause, 3000; quit; |
################################################## # パレット(.gp)や枠(.gs)の定義ファイルが # /usr/local/lib/yorick/version-number/g # にあります. ################################################## require, "plwf.i"; window3; orient3, -2*pi/3, pi/6; light3, ambient=1, diffuse=.5; cage3,1; //gnomon, on; //palette, "heat.gp"; //palette, "earth.gp"; //palette, "gray.gp"; x=span(-2*pi,2*pi,31)(,-:1:31); y=transpose(x); z=sin(x)*sin(y)/x/y; plwf, z, y, x, shade=1,ecolor="green"; draw3,1; eps, "plot3d"; pause, 3000; quit; |
################################################## # plfc でカラーマップが簡単に描けます. ################################################## x=span(-2*pi,2*pi,51)(,-:1:51); y=transpose(x); z=sin(x)*sin(y)/x/y; window, 0, style="work.gs"; xytitles, "X-label", "Y-label"; pltitle, "Contour"; //plfc, z, y, x,levs=span(-0.6,1.0,17); plc, z, y, x, levs=span(-0.6,1.0,17); eps, "contour"; pause, 3000; quit; |
Yorickはマルチプロットをサポートしていません. |