CompositeMap#
- class sunpy.map.CompositeMap(map1[, map2, ..])[source]#
Bases:
object
A Composite Map class
- Parameters:
args ([
Map
| string]) – One or more map of filepaths
Examples
>>> import sunpy.map >>> import sunpy.data.sample >>> comp_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE, ... sunpy.data.sample.EIT_195_IMAGE, ... composite=True) >>> comp_map.add_map(sunpy.map.Map(sunpy.data.sample.RHESSI_IMAGE)) >>> comp_map.peek()
Methods Summary
add_map
(amap[, zorder, alpha, levels])Adds a map to the CompositeMap.
draw_grid
([index, axes, grid_spacing])Draws a grid over the surface of the Sun.
draw_limb
([index, axes])Draws a circle representing the solar limb.
get_alpha
([index])Returns the alpha-channel value for a layer in the composite image.
get_levels
([index])Returns the list of contour levels for a map within the composite.
get_map
(index)Returns the map with given index
get_plot_settings
([index])Returns the plot settings for a map within the composite map.
get_zorder
([index])Returns the layering preference (z-order) for a map within the composite.
Prints a list of the currently included maps.
peek
([colorbar, draw_limb, draw_grid])Displays a graphical overview of the data in this object for user evaluation.
plot
([axes, annotate, title])Plots the composite map object by calling
plot()
ordraw_contours()
.remove_map
(index)Removes and returns the map with the given index.
set_alpha
(index, alpha)Sets the alpha-channel value for a layer in the composite image.
set_levels
(index, levels[, percent])Sets the contour levels for a layer in the composite image.
set_plot_settings
(index, plot_settings)Sets the plot settings for a layer in the composite image.
set_zorder
(index, zorder)Set the layering order (z-order) for a map within the composite.
Methods Documentation
- add_map(amap, zorder=None, alpha=1, levels=False)[source]#
Adds a map to the CompositeMap.
- Parameters:
amap (
GenericMap
or subclass) – Map instance to be addedzorder (
int
) – The index to use when determining where the map should lie along the z-axis; maps with higher z-orders appear above maps with lower z-orders.alpha (
float
) – Opacity at which the map should be displayed. An alpha value of 0 results in a fully transparent image while an alpha value of 1 results in a fully opaque image. Values between result in semi- transparent images.
- draw_grid(
- index=None,
- axes=None,
- grid_spacing: Unit("deg") = <Quantity 20. deg>,
- **kwargs,
Draws a grid over the surface of the Sun.
- Parameters:
- Returns:
matplotlib.axes.Axes
object
Notes
Keyword arguments are passed onto
sunpy.map.GenericMap.draw_grid
.
- draw_limb(index=None, axes=None, **kwargs)[source]#
Draws a circle representing the solar limb.
- Parameters:
index (
int
) – Map index to use to plot limb.axes (
matplotlib.axes.Axes
or None) – Axes to plot limb on or None to use current axes.
- Returns:
Notes
Keyword arguments are passed onto
sunpy.map.GenericMap.draw_limb
.
- get_plot_settings(index=None)[source]#
Returns the plot settings for a map within the composite map.
- get_zorder(index=None)[source]#
Returns the layering preference (z-order) for a map within the composite.
- peek(
- colorbar=True,
- draw_limb=True,
- draw_grid=False,
- **matplot_args,
Displays a graphical overview of the data in this object for user evaluation. For the creation of plots, users should instead use the
plot
method and Matplotlib’s pyplot framework.- Parameters:
colorbar (
bool
orint
) – Whether to display a colorbar next to the plot. If specified as an integer a colorbar is plotted for that index.draw_limb (
bool
) – If true, draws a circle representing the solar limb.draw_grid (
bool
) – If true, draws a grid over the surface of the Sun.**matplot_args (dict) – Matplotlib Any additional imshow arguments that should be used when plotting.
- plot(
- axes=None,
- annotate=True,
- title='SunPy Composite Plot',
- **matplot_args,
Plots the composite map object by calling
plot()
ordraw_contours()
.By default, each map is plotted as an image. If a given map has levels defined (via
set_levels()
), that map will instead be plotted as contours.- Parameters:
axes (
Axes
or None) – If provided the image will be plotted on the given axes. Else the current matplotlib axes will be used.annotate (
bool
) – If true, the data is plotted at it’s natural scale; with title and axis labels.title (
str
) – Title of the composite map.**matplot_args (
dict
) – Any additional Matplotlib arguments that should be used when plotting.
- Returns:
ret (
list
) – List of axes image or quad contour sets that have been plotted.
Notes
Images are plotted using either
imshow
orpcolormesh
, and contours are plotted usingcontour
. The Matplotlib arguments accepted by the plotting method are passed to it. (For compatibility reasons, we enforce a more restrictive set of acceptedpcolormesh
arguments.) If any Matplotlib arguments are not used by any plotting method, aTypeError
will be raised. Thesunpy.map.compositemap
module includes variables which list the full set of arguments passed to each plotting method. These are:>>> import sunpy.map.compositemap >>> sorted(sunpy.map.compositemap.ACCEPTED_IMSHOW_KWARGS) ['agg_filter', 'alpha', 'animated', 'annotate', 'array', 'aspect', 'autoalign', 'axes', 'clim', 'clip_box', 'clip_interval', 'clip_on', 'clip_path', 'cmap', 'colorizer', 'data', 'extent', 'figure', 'filternorm', 'filterrad', 'gid', 'in_layout', 'interpolation', 'interpolation_stage', 'label', 'mouseover', 'norm', 'origin', 'path_effects', 'picker', 'rasterized', 'resample', 'sketch_params', 'snap', 'title', 'transform', 'url', 'visible', 'vmax', 'vmin', 'zorder'] >>> sorted(sunpy.map.compositemap.ACCEPTED_PCOLORMESH_KWARGS) ['aa', 'agg_filter', 'alpha', 'animated', 'annotate', 'antialiased', 'antialiaseds', 'array', 'autoalign', 'axes', 'capstyle', 'clim', 'clip_box', 'clip_interval', 'clip_on', 'clip_path', 'cmap', 'colorizer', 'dashes', 'data', 'edgecolors', 'facecolors', 'fc', 'figure', 'gid', 'hatch', 'hatch_linewidth', 'in_layout', 'joinstyle', 'label', 'mouseover', 'norm', 'offset_transform', 'offsets', 'path_effects', 'paths', 'picker', 'pickradius', 'rasterized', 'shading', 'sketch_params', 'snap', 'title', 'transOffset', 'transform', 'url', 'urls', 'visible', 'vmax', 'vmin', 'zorder'] >>> sorted(sunpy.map.compositemap.ACCEPTED_CONTOUR_KWARGS) ['algorithm', 'alpha', 'antialiased', 'axes', 'clip_path', 'cmap', 'colorizer', 'colors', 'corner_mask', 'extend', 'extent', 'fill', 'filled', 'hatches', 'levels', 'linestyles', 'linewidths', 'locator', 'nchunk', 'negative_linestyles', 'norm', 'origin', 'transform', 'vmax', 'vmin']
If a transformation is required to overlay the maps with the correct alignment, the plot limits may need to be manually set because Matplotlib autoscaling may not work as intended.
- remove_map(index)[source]#
Removes and returns the map with the given index.
- Parameters:
index (
int
) – The index of the map in the composite map.- Returns:
sunpy.map.CompositeMap
– A composite map with the map indexed by ‘index’ removed from the composite map.
- set_alpha(index, alpha)[source]#
Sets the alpha-channel value for a layer in the composite image.
- Parameters:
- Returns:
CompositeMap
– A composite map with alpha-channel value ‘alpha’ at layer ‘index’.
- set_levels(index, levels, percent=False)[source]#
Sets the contour levels for a layer in the composite image.
- Parameters:
index (
int
) – The index of the map in the composite map.levels (array-like) – The contour levels.
percent (
bool
) – If True, the input ‘levels’ are interpreted as percentages relative to the maximum value of the data in layer ‘index’ of the composite map. If False, the contour levels are set directly from ‘levels’.
- Returns:
CompositeMap
– A composite map with contour levels ‘levels’ at layer ‘index’.
- set_plot_settings(index, plot_settings)[source]#
Sets the plot settings for a layer in the composite image.
- Parameters:
- Returns:
CompositeMap
– A composite map with plot settings ‘plot_settings’ at layer ‘index’.
- set_zorder(index, zorder)[source]#
Set the layering order (z-order) for a map within the composite.
- Parameters:
- Returns:
CompositeMap
– A composite map with the map at layer ‘index’ having layering order ‘zorder’.