Make alpha value to ClearColormap adjustable.

This commit is contained in:
Tony S Yu
2012-07-22 22:11:33 -04:00
parent 86b428952d
commit 9d1df0c3ce
2 changed files with 4 additions and 8 deletions
+2 -2
View File
@@ -65,10 +65,10 @@ class LinearColormap(LinearSegmentedColormap):
class ClearColormap(LinearColormap):
"""Color map that varies linearly from alpha = 0 to 1
"""
def __init__(self, rgb, name='clear_color'):
def __init__(self, rgb, max_alpha=1, name='clear_color'):
r, g, b = rgb
cg_speq = {'blue': [(0.0, b), (1.0, b)],
'green': [(0.0, g), (1.0, g)],
'red': [(0.0, r), (1.0, r)],
'alpha': [(0.0, 0.0), (1.0, 1.0)]}
'alpha': [(0.0, 0.0), (1.0, max_alpha)]}
LinearColormap.__init__(self, name, cg_speq)
+2 -6
View File
@@ -10,10 +10,7 @@ qApp = None
class ImageCanvas(FigureCanvasQTAgg):
"""Canvas for displaying images.
This canvas derives from Matplotlib, so your normal
"""
"""Canvas for displaying images."""
def __init__(self, parent, image, **kwargs):
self.fig, self.ax = figimage(image, **kwargs)
@@ -91,7 +88,6 @@ class ImageViewer(QtGui.QMainWindow):
self.layout = QtGui.QVBoxLayout(self.main_widget)
self.layout.addWidget(self.canvas)
#TODO: Set status bar to fixed-width font so status doesn't wiggle
status_bar = self.statusBar()
self.status_message = status_bar.showMessage
sb_size = status_bar.sizeHint()
@@ -109,7 +105,7 @@ class ImageViewer(QtGui.QMainWindow):
self.move(0, 0)
w = size.width()
y = 0
#TODO: Layout isn't correct for multiple plots (overlaps).
#TODO: Layout isn't correct for multiple plugins (overlaps).
for p in self.plugins:
p.move(w, y)
y += p.geometry().height()