CompositeMap

class sunpy.map.CompositeMap(map1[, map2, ..])[source] [edit on github]

Bases: object

A Composite Map class

Parameters:args ([Map | string]) – One or more map of filepaths
add_map(map, zorder=None, alpha=1, levels=False)[source] [edit on github]

Adds a map to the CompositeMap

remove_map(index)[source] [edit on github]

Removes and returns the map with the given index.

list_maps()[source] [edit on github]

Prints a list of the currently included maps.

get_alpha(index=None)[source] [edit on github]

Returns the alpha-channel value for a layer in the composite image

get_levels(index=None)[source] [edit on github]

Returns the list of contour levels for a map within the CompositeMap.

get_plot_settings(index=None)[source] [edit on github]

Returns the plot settings for a map within the CompositeMap.

get_zorder(index=None)[source] [edit on github]

Returns the layering preference (z-order) for a map within the composite.

set_alpha(index, alpha)[source] [edit on github]

Sets the alpha-channel value for a layer in the CompositeMap.

set_levels(index, levels, percent=False)[source] [edit on github]

Sets the contour levels for a layer in the CompositeMap.

set_plot_settings(index, plot_setiings)[source] [edit on github]

Set the plot settings for a map with the CompositeMap.

set_zorder(index, zorder)[source] [edit on github]

Set the layering preference (z-order) for a map within the CompositeMap.

plot(figure=None, overlays=None, draw_limb=False, gamma=1.0,
draw_grid=False, colorbar=True, basic_plot=False,title="SunPy Plot",
matplot_args)

Plots the composite map object using matplotlib

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.
list_maps() Prints a list of the currently included maps.
peek([colorbar, basic_plot, draw_limb, …]) Displays the map in a new figure.
plot([axes, annotate, title]) Plots the composite map object using matplotlib
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] [edit on github]

Adds a map to the CompositeMap.

Parameters:
  • amap (GenericMap or subclass) – Map instance to be added
  • zorder (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=<Quantity 20.0 deg>, **kwargs)[source] [edit on github]

Draws a grid over the surface of the Sun.

Parameters:
  • index (int) – Index to determine which map to use to draw grid.
  • axes (Axes or None) – Axes to plot limb on or None to use current axes.
  • grid_spacing (float) – Spacing (in degrees) for longitude and latitude grid.
Returns:

matplotlib.axes.Axes object

Notes

Keyword arguments are passed onto sunpy.map.mapbase.GenericMap.draw_grid.

draw_limb(index=None, axes=None, **kwargs)[source] [edit on github]

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:

matplotlib.axes.Axes

Notes

Keyword arguments are passed onto sunpy.map.mapbase.GenericMap.draw_limb.

get_alpha(index=None)[source] [edit on github]

Returns the alpha-channel value for a layer in the composite image.

get_levels(index=None)[source] [edit on github]

Returns the list of contour levels for a map within the composite.

Parameters:index ({int | None}) – The index of the map in the composite map.
Returns:list – A list of the contour levels of map at index ‘index’ in the composite map. If index is None, then the contour levels of all the maps are returned as a list of lists.
get_map(index)[source] [edit on github]

Returns the map with given index

get_plot_settings(index=None)[source] [edit on github]

Returns the plot settings for a map within the composite map.

Parameters:index ({int | None}) – The index of the map in the composite map.
Returns:{dict | list} – The plot settings of the map(s) in the composite map. If None then the plot settings of all the maps are returned in a list.
get_zorder(index=None)[source] [edit on github]

Returns the layering preference (z-order) for a map within the composite.

Parameters:index ({int | None}) – The index of the map in the composite map.
Returns:{float | list} – The layering order (z-order) of the map(s) in the composite map. If None then the layering order of all the maps is returned in a list.
list_maps()[source] [edit on github]

Prints a list of the currently included maps.

peek(colorbar=True, basic_plot=False, draw_limb=True, draw_grid=False, **matplot_args)[source] [edit on github]

Displays the map in a new figure.

Parameters:
  • colorbar (bool or int) – Whether to display a colorbar next to the plot. If specified as an integer a colorbar is plotted for that index.
  • basic_plot (bool) – If true, the data is plotted by itself at it’s natural scale; no title, labels, or axes are shown.
  • 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)[source] [edit on github]

Plots the composite map object using matplotlib

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) – Matplotlib Any additional imshow arguments that should be used when plotting.
Returns:

ret (list) – List of axes image or quad contour sets that have been plotted.

remove_map(index)[source] [edit on github]

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] [edit on github]

Sets the alpha-channel value for a layer in the composite image.

Parameters:
  • index (int) – The index of the map in the composite map.
  • alpha (float) – A float in the range 0 to 1.
Returns:

CompositeMap – A composite map with alpha-channel value ‘alpha’ at layer ‘index’.

set_levels(index, levels, percent=False)[source] [edit on github]

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] [edit on github]

Sets the plot settings for a layer in the composite image.

Parameters:
  • index (int) – The index of the map in the composite map.
  • plot_settings (dict) – A dictionary of the form
Returns:

CompositeMap – A composite map with plot settings ‘plot_settings’ at layer ‘index’.

set_zorder(index, zorder)[source] [edit on github]

Set the layering order (z-order) for a map within the composite.

Parameters:
  • index (int) – The index of the map in the composite map.
  • zorder (int) – The layer order.
Returns:

CompositeMap – A composite map with the map at layer ‘index’ having layering order ‘zorder’.