igorで行列データの等高線

loadwave M:行列、G:一般テキスト、 N:ファイル指定。
kugiri3:区切りウェーブ。
data11.dat : 行列
data12.dat : x列の長さベクトル
data13.dat : y列の長さベクトル
ディレクトリ: C:Users:username:Documents:

Window scale_2d() : Graph
	String header="data1"
	String filename= "C:Users:username:Documents:"+header+"1.dat"
	loadwave /M/G/N=a1 filename

	String filename2= "C:Users:username:Documents:"+header+"2.dat"
	loadwave /G/N=b1 filename2
	
	String filename3= "C:Users:username:Documents:"+header+"3.dat"
	loadwave /G/N=c1 filename3
	
	
	 Display;AppendMatrixContour a10 vs {b10,c10};DelayUpdate
       ModifyContour a10 rgbLines=(0,0,0),manLevels=kugiri3,labels=0
	ModifyGraph log=1
	
	
EndMacro

よりきちんと。

Window scale_2db() : Graph
	String header="s_mawaris_21_"
	String filename= "C:Users:username:Documents:"+header+"1.dat"
	String mat_wave1="matrix"+header
	String mat_wave1b="matrix"+header+"0"
	String mat_wave2="x1_"+header
	String mat_wave2b="x1_"+header+"0"
	String mat_wave3="y1_"+header
	String mat_wave3b="y1_"+header+"0"
	loadwave /M/G/N=$mat_wave1/O filename

	print mat_wave1b
	String filename2= "C:Users:username:Documents:"+header+"2.dat"
	loadwave /G/N=$mat_wave2/O filename2
	
	String filename3= "C:Users:username:Documents:"+header+"3.dat"
	loadwave /G/N=$mat_wave3/O filename3
	
	
	 Display;AppendMatrixContour $mat_wave1b vs {$mat_wave2b,$mat_wave3b};DelayUpdate
       ModifyContour  $mat_wave1b rgbLines=(0,0,0),manLevels=kugiri3,labels=0
	ModifyGraph log=1
	ModifyGraph fSize=25
	Label left "Y";DelayUpdate
	Label bottom "X"
	ModifyGraph standoff(bottom)=0
	ModifyGraph tick(bottom)=2
	ModifyGraph standoff(left)=0
	ModifyGraph tick(left)=2
	ModifyGraph mirror=1

EndMacro



さらにきちんと

Window scale_2db() : Graph
	#Parameter
	##Filename
	String header="test_"
	##Folder name 
	String dir1234="C:Documents and Settings:user1:My Documents:"
	##Levels 
	make /O/N=100 kugiri3
	kugiri3=0.5*x
	
	#Program
	String filename=dir1234+header+"1.dat"
	String mat_wave1="matrix"+header
	String mat_wave1b="matrix"+header+"0"
	String mat_wave2="x1_"+header
	String mat_wave2b="x1_"+header+"0"
	String mat_wave3="y1_"+header
	String mat_wave3b="y1_"+header+"0"
	loadwave /M/G/N=$mat_wave1/O filename

	print mat_wave1b
	String filename2=dir1234+header+"2.dat"
	loadwave /G/N=$mat_wave2/O filename2
	
	String filename3=dir1234+header+"3.dat"
	loadwave /G/N=$mat_wave3/O filename3
	
	
	 Display;AppendMatrixContour $mat_wave1b vs {$mat_wave2b,$mat_wave3b};DelayUpdate
       ModifyContour  $mat_wave1b rgbLines=(0,0,0),manLevels=kugiri3,labels=0
	ModifyGraph log=1
	ModifyGraph fSize=25
	Label left "Y";DelayUpdate
	Label bottom "X"
	ModifyGraph standoff(bottom)=0
	ModifyGraph tick(bottom)=2
	ModifyGraph standoff(left)=0
	ModifyGraph tick(left)=2
	ModifyGraph mirror=1

EndMacro

ファイル出力用 R スクリプトの例

matmat<-function(x,y,z,kugirix=27,kugiriy=27,nlevels=10,xlim=-1,ylim=-1,add=F, plot=T,col=1,base=exp(1),levels=NULL,file="abcdefghijklmn"){
dimx<-exp(seq(min(log(x)),max(log(x)),length.out=kugirix))
dimy<-exp(seq(min(log(y)),max(log(y)),length.out=kugiriy))
mat1<-matrix(nrow=(kugirix-1),ncol=(kugiriy-1))
mat2<-matrix(nrow=(kugirix-1),ncol=(kugiriy-1))
mat3<-matrix(nrow=(kugirix-1),ncol=(kugiriy-1))





for(i in 1:(length(dimx)-1)){

	
	for(j in 1:(length(dimy)-1)){
		mat1[i,j]<-0
		mat2[i,j]<-0
		d123<-z[x>=dimx[i] & x<dimx[i+1] & y>=dimy[j] & y<dimy[j+1]]
		
		mat1[i,j]<-median(log(d123[d123!=0],base=base))
		
		mat2[i,j]<-(log(length(d123[d123!=0]),base=base))
		mat3[i,j]<-(log(mean(d123[d123!=0]),base=base))

	}

}

	if(plot==T){

	
			contour(x=dimx[1:(length(dimx)-1)], y=dimy[1:(length(dimy)-1)],z=mat1,add=add,log="xy",nlevels=nlevels,col=col,levels=levels)
		
			#contour(x=dimx[1:(length(dimx)-1)], y=dimy[1:(length(dimy)-1],z=matmat1,log="xy")		

	}
	mid_x<-sqrt(dimx[1:(length(dimx)-1)]*dimx[2:(length(dimx))])
	mid_y<-sqrt(dimy[1:(length(dimy)-1)]*dimy[2:(length(dimy))])

	if(file!="abcdefghijklmn"){
		#mat1
		#mat3
		write.table(file="test_1.dat",mat1,col.names=F,row.names=F,na="NAN")
		write.table(file="test_2.dat",data.frame(mid_x),col.names=F,row.names=F,na="NAN")
		write.table(file="test_3.dat",data.frame(mid_y),col.names=F,row.names=F,na="NAN")
				

	}

	list(mat1,mat2,mat3,dimx,dimy,mid_x,mid_y)
}