In gnuplot pm3d map plot a 3d data into a surface with color as value of "z".
Lets say we have a data file something like this ..
0.00 0.00 0.00
0.00 1.00 0.00
0.00 2.00 0.00
0.00 3.00 1.9358
0.00 4.00 3.618
0.00 5.00 5.17
0.00 6.00 6.93
0.00 7.00 8.82
0.00 8.00 10.692
1.00 0.00 0.00
1.00 1.00 0.00
1.00 2.00 0.00
1.00 3.00 2.1318
....
...
In gnuplot prompt we will do something like this .
set pm3d map; set dgrid 20,20
sp "data.dat" u 1:2:3
and this will produce a figure something like a figure as shown above.
One of the big disadvantage of gnuplot in my opinion is not able to manipulate
data. Specifically if you look at the way interpolation is done. There is very little you can do with you data.
Here i will give you a simple example how to plot a 3d data
(3 column data or x,y,z ) in python name with the help of matplotlib/numpy/scipy.
One has to first make to data into 2d grid data. This is where the interpolation goes into. There are many different interpolation method one can use depending upon the requirement.
import numpy as np
import matplotlib.pyplot as pl
from scipy.interpolate import griddata
z=np.loadtxt("data.dat",usecols=[0,1,2],unpack=True)
x=np.arange(0,10.1,0.10)
y=np.arange(0,8.1,0.10)
zi=griddata((z[0],z[1]),z[2],(x[None,:], y[:,None]), method='cubic')
pl.imshow(zi,origin="lower",vmin=0,cmap="hot",aspect="auto",extent=[0,10,0,8])
pl.xlabel("U")
pl.ylabel("V")
pl.title("Zero-Temp gap ")
pl.colorbar()
pl.savefig("outAF.pdf")
reference
1. matplotlib Homepage http://matplotlib.org/
2. scipy griddata documentation Griddata
Lets say we have a data file something like this ..
0.00 0.00 0.00
0.00 1.00 0.00
0.00 2.00 0.00
0.00 3.00 1.9358
0.00 4.00 3.618
0.00 5.00 5.17
0.00 6.00 6.93
0.00 7.00 8.82
0.00 8.00 10.692
1.00 0.00 0.00
1.00 1.00 0.00
1.00 2.00 0.00
1.00 3.00 2.1318
....
...
In gnuplot prompt we will do something like this .
set pm3d map; set dgrid 20,20
sp "data.dat" u 1:2:3
and this will produce a figure something like a figure as shown above.
One of the big disadvantage of gnuplot in my opinion is not able to manipulate
data. Specifically if you look at the way interpolation is done. There is very little you can do with you data.
Here i will give you a simple example how to plot a 3d data
(3 column data or x,y,z ) in python name with the help of matplotlib/numpy/scipy.
One has to first make to data into 2d grid data. This is where the interpolation goes into. There are many different interpolation method one can use depending upon the requirement.
import numpy as np
import matplotlib.pyplot as pl
from scipy.interpolate import griddata
z=np.loadtxt("data.dat",usecols=[0,1,2],unpack=True)
x=np.arange(0,10.1,0.10)
y=np.arange(0,8.1,0.10)
zi=griddata((z[0],z[1]),z[2],(x[None,:], y[:,None]), method='cubic')
pl.imshow(zi,origin="lower",vmin=0,cmap="hot",aspect="auto",extent=[0,10,0,8])
pl.xlabel("U")
pl.ylabel("V")
pl.title("Zero-Temp gap ")
pl.colorbar()
pl.savefig("outAF.pdf")
reference
1. matplotlib Homepage http://matplotlib.org/
2. scipy griddata documentation Griddata
This method is great!
ReplyDeleteThanks.
DeleteThis post really helps me, thanksss
ReplyDelete