forked from sunpy/eitwave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualize.py
34 lines (28 loc) · 1.09 KB
/
visualize.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
from __future__ import absolute_import
__authors__ = ["Albert Shih"]
__email__ = "[email protected]"
def visualize(wave_maps, delay = 0.1, range = None):
"""
Visualizes a list of SunPy Maps. Requires matplotlib 1.1
"""
import matplotlib.pyplot as plt
from matplotlib import colors
fig = plt.figure()
axes = fig.add_subplot(111)
axes.set_xlabel('X-position [' + wave_maps[0].units['x'] + ']')
axes.set_ylabel('Y-position [' + wave_maps[0].units['y'] + ']')
extent = wave_maps[0].xrange + wave_maps[0].yrange
axes.set_title("%s %s" % (wave_maps[0].name, wave_maps[0].date))
params = {
"cmap": wave_maps[0].cmap,
"norm": wave_maps[0].norm
}
if range != None:
params["norm"] = colors.Normalize(range[0],range[1])
img = axes.imshow(wave_maps[0], origin='lower', extent=extent, **params)
fig.colorbar(img)
fig.show()
for current_wave_map in wave_maps[1:]:
axes.set_title("%s %s" % (current_wave_map.name, current_wave_map.date))
img.set_data(current_wave_map)
plt.pause(delay)