本文整理汇总了Python中sunpy.map.Map.plot方法的典型用法代码示例。如果您正苦于以下问题:Python Map.plot方法的具体用法?Python Map.plot怎么用?Python Map.plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sunpy.map.Map
的用法示例。
在下文中一共展示了Map.plot方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test2
# 需要导入模块: from sunpy.map import Map [as 别名]
# 或者: from sunpy.map.Map import plot [as 别名]
def test2():
aia = Map(sunpy.AIA_171_IMAGE)
fig = plt.figure()
ax = plt.subplot(111)
aia.plot()
plt.colorbar()
aia.draw_limb()
plt.show()
示例2: len
# 需要导入模块: from sunpy.map import Map [as 别名]
# 或者: from sunpy.map.Map import plot [as 别名]
c_map_cm.set_under('k', alpha=0.001)
c_map.set_colors(1, c_map_cm)
c_map.set_alpha(1, 0.8)
# Create the figure
plt.close('all')
figure = plt.figure()
axes = figure.add_subplot(111)
if for_paper:
observation = r"AIA {:s}".format(mc[0].measurement._repr_latex_())
title = "wave progress map\n{:s}".format(observation)
image_file_type = 'eps'
else:
title = "{:s} ({:s})".format(observation_date, wave_name)
image_file_type = 'png'
ret = c_map.plot(axes=axes, title=title)
c_map.draw_limb()
c_map.draw_grid()
# Set up the color bar
nticks = 6
timestamps_index = np.linspace(1, len(timestamps)-1, nticks, dtype=np.int).tolist()
cbar_tick_labels = []
for index in timestamps_index:
wpm_time = timestamps[index].strftime("%H:%M:%S")
cbar_tick_labels.append(wpm_time)
cbar = figure.colorbar(ret[1], ticks=timestamps_index)
cbar.ax.set_yticklabels(cbar_tick_labels)
cbar.set_label('time (UT) ({:s})'.format(observation_date))
cbar.set_clim(vmin=1, vmax=len(timestamps))
示例3: myplot
# 需要导入模块: from sunpy.map import Map [as 别名]
# 或者: from sunpy.map.Map import plot [as 别名]
mc[i].plot_settings['norm'] = norm3
im = mc[i].plot()
mc[i].draw_grid(grid_spacing=5*u.deg)
mc[i].draw_limb()
cbar = fig.colorbar(im, cmap=cmap3, ticks=temps, norm=norm3,
orientation='vertical', spacing='proportional',
boundaries=boundaries)
cbar.ax.set_yticklabels(['0.5', '1.0', '2.0', '4.0', '6.0', '9.0', '14.0'])
cbar.ax.set_ylabel('MK')
#plt.colorbar(label='temperature (MK)')
plt.title('maximum temperature\n{:s}'.format(mc[i].date.strftime(date_format)))
filepath = os.path.join(output_directory, '{:s}_jet_dem_temp_{:n}.png'.format(jet_number_string, i))
plt.savefig(filepath)
def myplot(fig, ax, sunpy_map):
p = sunpy_map.draw_limb()
p = sunpy_map.draw_grid(grid_spacing=5*u.deg)
ax.set_title('maximum temperature\n{:s}'.format(sunpy_map.date.strftime(date_format)))
#fig.colorbar(sunpy_map.plot())
return p
ani = mc.plot(plot_function=myplot)
Writer = animation.writers['avconv']
writer = Writer(fps=20, metadata=dict(artist='SunPy'), bitrate=18000)
fname = os.path.join(output_directory, '{:s}_maximum_temperature.mp4'.format(jet_number_string))
ani.save(fname, writer=writer)
示例4: compare
# 需要导入模块: from sunpy.map import Map [as 别名]
# 或者: from sunpy.map.Map import plot [as 别名]
def compare(self, display_wlen='171', context_wlen=None, extra_maps=[]):
# temp_args=None, temp_kwargs=None,
# wlen_args=None, wlen_kwargs=None,
# ctxt_args=None, ctxt_kwargs=None,
# extr_args=None, extr_kwargs=None):
valid_wlens = ['94', '131', '171', '195', '211', '335', '304', 'hmi']
if display_wlen.lower() not in valid_wlens:
print "Display wavelength provided invalid or None."
output = self.plot()#*temp_args, **temp_kwargs)
return output
save_output = True
data_dir = self.data_dir
maps_dir = self.maps_dir
date = self.date
nmaps = 2 + len(extra_maps)
if context_wlen:
nrows = 2
else:
nrows = 1
fig = plt.figure(figsize=(24, 14))
fig.add_subplot(nrows, nmaps, nmaps, axisbg='k')
self.plot()#*temp_args, **temp_kwargs)
plt.colorbar(orientation='horizontal')
displaymap = Map(data_dir+'{0}/{1:%Y/%m/%d}/aia*{0}*t{1:%H?%M}*lev1?fits'\
.format(display_wlen, date))
if isinstance(displaymap, list):
displaymap = displaymap[0]
displaymap = aiaprep(displaymap)
displaymap /= displaymap.exposure_time
fig.add_subplot(nrows, nmaps, 1, axisbg='k')
displaymap.plot()#*wlen_args, **wlen_kwargs)
plt.colorbar(orientation='horizontal')
if context_wlen and self.region != None:
context_plot = fig.add_subplot(nrows, 1, nrows)
contextmap = Map(data_dir+'{0}/{1:%Y/%m/%d}/aia*{0}*t{1:%H?%M}*lev1?fits'.format(context_wlen, date))
if isinstance(contextmap, list):
contextmap = contextmap[0]
x, y = self.region_coordinate['x'], self.region_coordinate['y']
contextmap = contextmap.submap([-1000, 1000], [y-300, y+300])
# Need to figure out how to get 'subimsize' from self. Use the default 150'' for now
#rect = patches.Rectangle([x-subdx, y-subdx], subimsize[0], subimsize[1], color='white', fill=False)
rect = patches.Rectangle([x-150, y-150], 300, 300, color='white',
fill=False)
contextmap.plot()#*ctxt_args, **ctxt_kwargs)
context_plot.add_artist(rect)
for m, thismap in extra_maps:
fig.add_subplot(nrows, nmaps, 3+m)
thismap.plot()#*extr_args, **extr_kwargs)
if save_output:
error = sys('touch '+maps_dir+'maps/{:%Y/%m/%d/} > shelloutput.txt'.format(date))
if error != 0:
sys('{0}{1:%Y}; {0}{1:%Y/%m}; {0}{1:%Y/%m/%d} > shelloutput.txt'\
.format('mkdir '+maps_dir+'maps/', date))
filename = maps_dir+'maps/{:%Y/%m/%d/%Y-%m-%dT%H:%M:%S}_with{}'.\
format(date, display_wlen)
plt.savefig(filename)
if self.region != None:
reg_dir = maps_dir + 'maps/region_maps'
reg_dir = reg_dir + '/{}/'. format(self.region)
error = sys('touch ' + reg_dir + ' > shelloutput.txt')
if error != 0:
sys('mkdir ' + reg_dir + ' > shelloutput.txt')
plt.savefig(reg_dir+'{:%Y-%m-%dT%H:%M:%S}'.format(date))
plt.close()
else:
plt.show()
return
示例5: TMap
# 需要导入模块: from sunpy.map import Map [as 别名]
# 或者: from sunpy.map.Map import plot [as 别名]
from astropy import units as u
from scipy.interpolate import RegularGridInterpolator as rgi
from itertools import product
emmapcubehelix = _cm.cubehelix(s=2.8, r=-0.7, h=1.4, gamma=1.0)
cm.register_cmap(name='emhelix', data=emmapcubehelix)
emcm = cm.get_cmap('emhelix')
# Load a temperature map and get the EM data out of it
tmap = TMap('2011-02-15', maps_dir=expanduser('~/coronal-backprojection/'),
n_params=3)
EMmap = Map(10.0**tmap.emission_measure, tmap.meta.copy())
EMlog = Map(tmap.emission_measure, tmap.meta.copy())
print np.nanmin(EMlog.data), np.nanmax(EMlog.data)
fig = plt.figure(figsize=(32, 24))
EMlog.plot(cmap=emcm)
plt.colorbar()
plt.savefig('input-em')
plt.close()
# Define ranges of reconstruction space
rsun = EMmap.rsun_arcseconds
xrange = (EMmap.xrange[0] / rsun, EMmap.xrange[1] / rsun)
yrange = (EMmap.yrange[0] / rsun, EMmap.yrange[1] / rsun)
zrange = [min([xrange[0], yrange[0]]), max([xrange[1], yrange[1]])]
print xrange, yrange, zrange
side = 1024
try:
# Attempt to load distribution and coordinates files
示例6: Map
# 需要导入模块: from sunpy.map import Map [as 别名]
# 或者: from sunpy.map.Map import plot [as 别名]
import matplotlib.pyplot as plt
from sunpy.map import Map
import sunpy.data.sample as s
import numpy as np
aia = Map(s.AIA_171_IMAGE)
fig, axs = plt.subplots(1,2)
aia.plot(axes=axs[0])
aia.draw_grid()
r = [11.52, 10.42, 6.14, 3.64, 2.75]
e = [10, 20, 30, 40, 50]
pixel_size = 3.4
number_of_pixels = 160
center = np.array([461, 303])
line_color = 'w'
rect = plt.Rectangle(center - pixel_size * number_of_pixels/2., pixel_size * number_of_pixels, pixel_size * number_of_pixels, fill=False, color=line_color)
ax[0].add_artist(rect)
rect = plt.Rectangle(center - pixel_size/2., pixel_size, pixel_size, fill=False, color=line_color)
ax[0].add_artist(rect)
for radius, energy in zip(r,e):
circle = plt.Circle(center, radius=radius*60, fill=False, label=str(energy), color=line_color)
ax[0].add_artist(circle)
plt.colorbar()
plt.legend()
示例7: Map
# 需要导入模块: from sunpy.map import Map [as 别名]
# 或者: from sunpy.map.Map import plot [as 别名]
from pyfoxsi.psf import convolve
from sunpy.map import Map
import matplotlib.pyplot as plt
f = '/Users/schriste/Google Drive/Work/FOXSI SMEX/Data/hsi_image_20050513_164526to164626_pixon_3arcsecx64_25to50kev_d1to9.fits'
hsi = Map(f)
foxsi_map = convolve(hsi)
plt.figure()
plt.subplot(1, 2, 1)
hsi.plot()
plt.subplot(1, 2, 2)
foxsi_map.plot()
plt.show()
示例8: makedirs
# 需要导入模块: from sunpy.map import Map [as 别名]
# 或者: from sunpy.map.Map import plot [as 别名]
emiss.meta['cdelt2'] = temps[1] - temps[0]
#emiss.meta['crval1'] = widths[0]
emiss.meta['crval1'] = heights[0] #np.log10(heights[0])
emiss.meta['crval2'] = temps[0]
emiss.meta['crpix1'] = 0.5
emiss.meta['crpix2'] = 0.5
if wlength == '94': wlength = '094'
fits_dir = path.join(CThome, 'data', 'synthetic', wlength)
if not path.exists(fits_dir): makedirs(fits_dir)
emiss.save(path.join(fits_dir, 'model.fits'), clobber=True)
#print '----', emission[2, :, :, :].min(), emission[2, :, :, :].max()
#print '------', emission[2, :, w, :].min(), emission[2, :, w, :].max()
emiss.data /= emission[2, :, w, :]
#print '--------', emiss.min(), emiss.max()
ax = fig.add_subplot(1, 6, wl+1)
emiss.plot(aspect='auto', vmin=emiss.min(), vmax=emiss.max())
plt.title('{}'.format(wlength))
plt.xlabel('Input EM')
plt.ylabel('Input log(T)')
plt.colorbar()
#fig.gca().add_artist(rect)
plt.axvline(20.0, color='white')
plt.axvline(35.0, color='white')
plt.axhline(5.6, color='white')
plt.axhline(7.0, color='white')
#plt.savefig(path.join(outdir, 'model_emission_h={}'.format(np.log10(wid)).replace('.', '_')))
plt.savefig(path.join(outdir, 'model_emission_w={}'.format(wid).replace('.', '_')))
plt.close()
#images = [Map(emission[i, :, :, w], mapmeta) for i in range(6)]
images = [Map(emission[i, :, w, :], mapmeta) for i in range(6)]