Skip to content
Snippets Groups Projects
Commit c8791620 authored by (no author)'s avatar (no author)
Browse files

adding a new method to allow for even simpler image displays

git-svn-id: https://svn.ssec.wisc.edu/repos/glance/trunk@224 8a9318a1-56ba-4d59-b755-99d26321be01
parent 820a47c3
No related branches found
No related tags found
No related merge requests found
...@@ -573,7 +573,31 @@ def create_quiver_mapped_figure(data, latitude, longitude, baseMapInstance, boun ...@@ -573,7 +573,31 @@ def create_quiver_mapped_figure(data, latitude, longitude, baseMapInstance, boun
return figure return figure
def create_simple_figure(data, figureTitle, invalidMask=None, tagData=None, colorMap=None, colorbarLimits=None, units=None) : def create_raw_image_plot(data, figureTitle, hideAxesLabels=True) :
"""
for drawing rgb and rgba images we want an uncomplicated version of this call
"""
# build the plot
figure = plt.figure()
axes = figure.add_subplot(111)
if (data is not None) :
# draw our data
im = plt.imshow(data)
# set the title
axes.set_title(figureTitle)
if hideAxesLabels :
axes.get_xaxis().set_visible(False)
axes.get_yaxis().set_visible(False)
return figure
def create_simple_figure(data, figureTitle, invalidMask=None, tagData=None,
colorMap=None, colorbarLimits=None, units=None,
drawColorbar=True) :
""" """
create a simple figure showing the data given masked by the invalid mask create a simple figure showing the data given masked by the invalid mask
any tagData passed in will be interpreted as mismatch points on the image and plotted as a any tagData passed in will be interpreted as mismatch points on the image and plotted as a
...@@ -594,20 +618,23 @@ def create_simple_figure(data, figureTitle, invalidMask=None, tagData=None, colo ...@@ -594,20 +618,23 @@ def create_simple_figure(data, figureTitle, invalidMask=None, tagData=None, colo
# if we've got a color map, pass it to the list of things we want to tell the plotting function # if we've got a color map, pass it to the list of things we want to tell the plotting function
if not (colorMap is None) : if not (colorMap is None) :
kwargs['cmap'] = colorMap kwargs['cmap'] = colorMap
if colorMap is np.nan :
kwargs['cmap'] = None
if (data is not None) and (np.sum(invalidMask) < invalidMask.size) : if (data is not None) and (np.sum(invalidMask) < invalidMask.size) :
# draw our data # draw our data
im = imshow(cleanData, **kwargs) im = imshow(cleanData, **kwargs)
# if our colorbar has limits set those if drawColorbar :
if colorbarLimits is not None : # if our colorbar has limits set those
LOG.debug("setting colorbar limits: " + str(colorbarLimits)) if colorbarLimits is not None :
clim(vmin=colorbarLimits[0], vmax=colorbarLimits[-1]) LOG.debug("setting colorbar limits: " + str(colorbarLimits))
# make a color bar clim(vmin=colorbarLimits[0], vmax=colorbarLimits[-1])
cbar = colorbar(format='%.3g') # make a color bar
# add the units to the colorbar cbar = colorbar(format='%.3g')
if str.lower(str(units)) != "none" : # add the units to the colorbar
cbar.set_label(units) if str.lower(str(units)) != "none" :
cbar.set_label(units)
# and some informational stuff # and some informational stuff
axes.set_title(figureTitle) axes.set_title(figureTitle)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment