Last active
October 10, 2018 13:51
-
-
Save bluepost59/1f844f0aa9914b2b622c192e5c969edc to your computer and use it in GitHub Desktop.
資料作りのためのmatplotlib入門(2) 2次元contour図 ref: https://qiita.com/Bluepost59/items/a0869aee34db3f450162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt | |
nx = 100 | |
ny = 200 | |
mydata = np.loadtxt('mydata.txt') | |
xx = np.linspace(0,nx,nx) | |
yy = np.linspace(0,ny,ny) | |
xx,yy = np.meshgrid(xx,yy) | |
zz = mydata[:,2].reshape(nx,ny).T | |
myfig = plt.figure() | |
myax = myfig.add_subplot(1,1,1) | |
myim = myax.pcolor(xx,yy,zz) | |
myfig.colorbar(myim) | |
myfig.savefig('contour.png') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do i = 1,Nx | |
do j = 1,Ny | |
write(UNITNUM,*) i,j,A(i,j) | |
end do | |
end do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 1 0.000 | |
1 2 1.000 | |
... | |
1 10 0.424 | |
2 1 0.242 | |
... | |
10 10 0.551 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment