Skip to content

Commit 06ad2de

Browse files
committed
Merge pull request #86 from nipy/fix_montage
Check if colorbar is none before seting visibility
2 parents e467ade + 3aa8484 commit 06ad2de

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

surfer/viz.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,8 @@ def _get_colorbars(self, row, col):
16111611

16121612
def _colorbar_visibility(self, visible, row, col):
16131613
for cb in self._get_colorbars(row, col):
1614-
cb.visible = visible
1614+
if cb is not None:
1615+
cb.visible = visible
16151616

16161617
def show_colorbar(self, row=-1, col=-1):
16171618
"""Show colorbar(s) for given plot
@@ -1937,7 +1938,8 @@ def save_montage(self, filename, order=['lat', 'ven', 'med'],
19371938
colorbars = self._get_colorbars(row, col)
19381939
colorbars_visibility = dict()
19391940
for cb in colorbars:
1940-
colorbars_visibility[cb] = cb.visible
1941+
if cb is not None:
1942+
colorbars_visibility[cb] = cb.visible
19411943

19421944
images = self.save_imageset(None, views, colorbar=colorbar, row=row,
19431945
col=col)
@@ -1947,7 +1949,8 @@ def save_montage(self, filename, order=['lat', 'ven', 'med'],
19471949
# get back original view and colorbars
19481950
mlab.view(*current_view, figure=brain._f)
19491951
for cb in colorbars:
1950-
cb.visible = colorbars_visibility[cb]
1952+
if cb is not None:
1953+
cb.visible = colorbars_visibility[cb]
19511954
return out
19521955

19531956
def animate(self, views, n_steps=180., fname=None, use_cache=False,

0 commit comments

Comments
 (0)