-
Notifications
You must be signed in to change notification settings - Fork 2
/
plot.py
55 lines (48 loc) · 1.68 KB
/
plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import matplotlib
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from pylab import *
#import os.path
#import string
import csv
import math
#from scipy import fftpack
#from scipy import signal
#import pyfits
import numpy as np
import pylab as py
#from scipy import weave
#from scipy import interpolate
#from scipy.optimize import curve_fit
#from scipy.interpolate import UnivariateSpline
#from numpy import genfromtxt
colormap = 'bone' #Options: 'classic', 'hot', 'pink', 'earth', 'heat', 'bone'
surface_datatype = 'zview' #Options: 'xcross', 'ycross', 'zview'
the_dpi = 80
def make_image(filename, data):
fig = plt.figure()
dimensions = float(data_resolution)/float(the_dpi)
fig.set_size_inches(dimensions, dimensions)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
if colormap == 'classic':
ax.imshow(data, aspect = 'normal', cmap=cm.gray)
elif colormap == 'hot':
ax.imshow(data, aspect = 'normal', cmap=cm.hot)
elif colormap == 'pink':
ax.imshow(data, aspect = 'normal', cmap=cm.pink)
elif colormap == 'earth':
ax.imshow(data, aspect = 'normal', cmap=cm.gist_earth)
elif colormap == 'heat':
ax.imshow(data, aspect = 'normal', cmap=cm.gist_heat)
elif colormap == 'bone':
ax.imshow(data, aspect = 'normal', cmap=cm.bone)
else:
ax.imshow(data, aspect = 'normal', cmap=cm.gray)
plt.savefig(filename + '.png', dpi = the_dpi)
data = np.genfromtxt('KPZ_2d_noise50000.csv', delimiter=',')
fdata = np.flipud(data)
data_resolution = fdata.shape[0]
make_image('50000_', fdata)
print "Program finished"