diff --git a/examples/computer_vision_techniques/off_limb_enhance.py b/examples/computer_vision_techniques/off_limb_enhance.py index d102d12567a..8840874ab7a 100644 --- a/examples/computer_vision_techniques/off_limb_enhance.py +++ b/examples/computer_vision_techniques/off_limb_enhance.py @@ -72,8 +72,8 @@ # We set the normalization of the new map to be the same as the original map # to compare the two. scaled_map = sunpy.map.Map(aia.data * scale_factor, aia.meta) -scaled_map.plot_settings['norm'] = ImageNormalize(stretch=aia.plot_settings['norm'].stretch, - vmin=aia.data.min(), vmax=aia.data.max()) +scaled_map.norm = ImageNormalize(stretch=aia.norm.stretch, + vmin=aia.data.min(), vmax=aia.data.max()) ############################################################################### # Let's plot the results diff --git a/examples/plotting/hmi_synoptic_maps.py b/examples/plotting/hmi_synoptic_maps.py index 32eb18cd424..e4714e1f6b4 100644 --- a/examples/plotting/hmi_synoptic_maps.py +++ b/examples/plotting/hmi_synoptic_maps.py @@ -47,8 +47,8 @@ ############################################################################### # Let's also fix the plot settings -syn_map.plot_settings['cmap'] = 'hmimag' -syn_map.plot_settings['norm'] = plt.Normalize(-1500, 1500) +syn_map.cmap = 'hmimag' +syn_map.norm = plt.Normalize(-1500, 1500) ############################################################################### # Let's plot the results diff --git a/examples/plotting/map_editcolormap.py b/examples/plotting/map_editcolormap.py index 35fc1c70774..1bcf6b3a48a 100644 --- a/examples/plotting/map_editcolormap.py +++ b/examples/plotting/map_editcolormap.py @@ -17,12 +17,12 @@ aiamap = sunpy.map.Map(AIA_171_IMAGE) ############################################################################### -# All plot settings for a map are stored in the `plot_settings` attribute. +# The Colormap and Normalization attributes for a map are accessed as a property of the map. # How a Map is displayed is determined by its colormap, which sets the colors # , and the normalization, which sets how data values are translated to colors. # Lets replace the colormap and normalization. -aiamap.plot_settings['cmap'] = plt.get_cmap('Greys_r') -aiamap.plot_settings['norm'] = colors.LogNorm(100, aiamap.max()) +aiamap.cmap = plt.get_cmap('Greys_r') +aiamap.norm = colors.LogNorm(100, aiamap.max()) ############################################################################### # To see all of the colormaps SunPy provides see `sunpy.visualization.colormaps`. diff --git a/examples/sunpy_other_packages/reprojection_aia_euvi_mosaic.py b/examples/sunpy_other_packages/reprojection_aia_euvi_mosaic.py index 5855217dad4..0808e55c554 100644 --- a/examples/sunpy_other_packages/reprojection_aia_euvi_mosaic.py +++ b/examples/sunpy_other_packages/reprojection_aia_euvi_mosaic.py @@ -114,10 +114,11 @@ ###################################################################### # To display the output we construct a new map using the new array and our -# generated header. We also borrow the plot settings from the AIA map. +# generated header. We also borrow the Colormap and Normalization attributes from the AIA map. outmap = sunpy.map.Map((array, header)) -outmap.plot_settings = maps[0].plot_settings +outmap.cmap = maps[0].cmap +outmap.norm = maps[0].norm outmap.plot() plt.show() @@ -183,7 +184,8 @@ # little. outmap = sunpy.map.Map((array, header)) -outmap.plot_settings = maps[0].plot_settings +outmap.cmap = maps[0].cmap +outmap.norm = maps[0].norm outmap.nickname = 'AIA + EUVI/A + EUVI/B' plt.figure(figsize=(10, 5)) diff --git a/examples/sunpy_other_packages/reprojection_align_aia_hmi.py b/examples/sunpy_other_packages/reprojection_align_aia_hmi.py index a193ee6aa5e..eb72c2d6678 100644 --- a/examples/sunpy_other_packages/reprojection_align_aia_hmi.py +++ b/examples/sunpy_other_packages/reprojection_align_aia_hmi.py @@ -46,8 +46,8 @@ map_aia, map_hmi = [m.resample((1024, 1024)*u.pix) for m in sunpy.map.Map(sorted(files))] # Why do we have to do this? -map_hmi.plot_settings['cmap'] = "hmimag" -map_hmi.plot_settings['norm'] = plt.Normalize(-2000, 2000) +map_hmi.cmap = "hmimag" +map_hmi.norm = plt.Normalize(-2000, 2000) ###################################################################### # Plot both images side by side. @@ -74,8 +74,8 @@ # Construct an output map and set some nice plotting defaults. out_hmi = sunpy.map.Map(output, map_aia.wcs) -out_hmi.plot_settings['cmap'] = "hmimag" -out_hmi.plot_settings['norm'] = plt.Normalize(-1500, 1500) +out_hmi.cmap = "hmimag" +out_hmi.norm = plt.Normalize(-1500, 1500) fig = plt.figure() ax1 = fig.add_subplot(1, 2, 1, projection=map_aia) diff --git a/examples/sunpy_other_packages/reprojection_different_observers.py b/examples/sunpy_other_packages/reprojection_different_observers.py index 2d8e684ad68..64a76d6b9ed 100644 --- a/examples/sunpy_other_packages/reprojection_different_observers.py +++ b/examples/sunpy_other_packages/reprojection_different_observers.py @@ -93,7 +93,8 @@ # to the AIA image. outmap = sunpy.map.Map(output, out_header) -outmap.plot_settings = map_stereo.plot_settings +outmap.cmap = map_stereo.cmap +outmap.norm = map_stereo.norm fig = plt.figure() ax1 = fig.add_subplot(1, 2, 1, projection=map_aia) @@ -149,7 +150,8 @@ # We generate the output map and plot it next to the original image. outmap = sunpy.map.Map((output, mars_header)) -outmap.plot_settings = map_aia.plot_settings +outmap.cmap = map_aia.cmap +outmap.norm = map_aia.norm fig = plt.figure() diff --git a/examples/sunpy_other_packages/reprojection_heliographic_stonyhurst.py b/examples/sunpy_other_packages/reprojection_heliographic_stonyhurst.py index bde664de6c5..07f7db81162 100644 --- a/examples/sunpy_other_packages/reprojection_heliographic_stonyhurst.py +++ b/examples/sunpy_other_packages/reprojection_heliographic_stonyhurst.py @@ -57,7 +57,8 @@ array, footprint = reproject_interp(aia_map, out_wcs, shape_out=shape_out) outmap = sunpy.map.Map((array, header)) -outmap.plot_settings = aia_map.plot_settings +outmap.cmap = aia_map.cmap +outmap.norm = aia_map.norm ############################################################################### # Plot the result. diff --git a/sunpy/map/compositemap.py b/sunpy/map/compositemap.py index 91825f27856..e9443887a23 100644 --- a/sunpy/map/compositemap.py +++ b/sunpy/map/compositemap.py @@ -422,8 +422,8 @@ def plot(self, axes=None, annotate=True, # pylint: disable=W0613 params = { "origin": "lower", "extent": x_range + y_range, - "cmap": m.plot_settings['cmap'], - "norm": m.plot_settings['norm'], + "cmap": m.cmap, + "norm": m.norm, "alpha": m.alpha, "zorder": m.zorder, } diff --git a/sunpy/map/mapbase.py b/sunpy/map/mapbase.py index 551b4e04d33..d5719cf81ef 100644 --- a/sunpy/map/mapbase.py +++ b/sunpy/map/mapbase.py @@ -58,8 +58,9 @@ class GenericMap(NDData): Colormap of the map image. Defaults to 'grey' norm : `matplotlib.colors.Normalize` Normalization function used. Defaults to None - plot_settings : dict, optional - Plot settings (Deprecated, will be removed in 2.1) + plot_settings : `dict`, optional + Keyword arguments to be passed to `~matplotlib.pyplot.imshow` + (Deprecated, will be removed in 2.1) Other Parameters ---------------- **kwargs : @@ -204,7 +205,7 @@ def __init__(self, data, header, cmap='gray', norm=None, plot_settings=None, **k if plot_settings: self.plot_settings = plot_settings warnings.warn("Handling of ``plot_settings`` is deprecated." - "Subsequently, setting ``plot_settings`` will have no effect on the plot." + "Subsequently setting ``plot_settings`` will have no effect on the plot." "Pass the plot specific settings to either ``.peek()`` or ``.show()``", DeprecationWarning) if 'norm' in self.plot_settings: diff --git a/sunpy/map/mapsequence.py b/sunpy/map/mapsequence.py index ac9d01cee63..a60814f03d6 100644 --- a/sunpy/map/mapsequence.py +++ b/sunpy/map/mapsequence.py @@ -193,9 +193,9 @@ def updatefig(i, im, annotate, ani_data, removes): removes.pop(0).remove() im.set_array(ani_data[i].data) - im.set_cmap(ani_data[i].plot_settings['cmap']) + im.set_cmap(ani_data[i].cmap) - norm = deepcopy(ani_data[i].plot_settings['norm']) + norm = deepcopy(ani_data[i].norm) # The following explicit call is for bugged versions of Astropy's # ImageNormalize norm.autoscale_None(ani_data[i].data)