Skip to content

Commit 4352dcf

Browse files
committed
Enable matplotlib cmap color scales (fixes #99) and fix buggy zoom image behavior
1 parent 9003ae6 commit 4352dcf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spectral/graphics/spypylab.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def handle_event(self, event):
469469
except:
470470
f = plt.figure()
471471
self.view.spectrum_plot_fig_id = f.number
472-
s = plt.subplot(111)
472+
s = f.gca()
473473
settings.plotter.plot(self.view.source[r, c],
474474
self.view.source)
475475
s.xaxis.axes.relim()
@@ -659,8 +659,8 @@ def _update_data_rgb(self):
659659
# If it is a gray-scale image, only keep the first RGB component so
660660
# matplotlib imshow's cmap can still be used.
661661
if self.data_rgb_meta['mode'] == 'monochrome' and \
662-
self.data_rgb.ndim ==3:
663-
(self.bands is not None and len(self.bands) == 1)
662+
self.data_rgb.ndim == 3:
663+
self.data_rgb = self.data_rgb[:, :, 0]
664664

665665
def set_classes(self, classes, colors=None, **kwargs):
666666
'''Sets the array of class values associated with the image data.
@@ -1064,8 +1064,8 @@ def open_zoom(self, center=None, size=None):
10641064
view.imshow_data_kwargs.update(kwargs)
10651065
view.imshow_class_kwargs = self.imshow_class_kwargs.copy()
10661066
view.imshow_class_kwargs.update(kwargs)
1067-
view.set_display_mode(self.display_mode)
10681067
view.callbacks_common = self.callbacks_common
1068+
view.spectrum_plot_fig_id = self.spectrum_plot_fig_id
10691069
view.show(fignum=fig.number, mode=self.display_mode)
10701070
view.axes.set_xlim(0, size)
10711071
view.axes.set_ylim(size, 0)
@@ -1296,7 +1296,6 @@ def plot(data, source=None):
12961296
data[:, np.array(source.metadata['bbl']) == 0] = None
12971297
for x in data:
12981298
p = plt.plot(xvals, x)
1299-
plt.hold(1)
13001299
spectral._xyplot = p
13011300
plt.grid(1)
13021301
if source is not None and hasattr(source, 'bands'):

0 commit comments

Comments
 (0)