MCPcopy Create free account
hub / github.com/danjgale/surfplot / __init__

Method __init__

surfplot/plotting.py:223–253  ·  view source on GitHub ↗
(self, surf_lh=None, surf_rh=None, layout='grid', views=None, 
                 mirror_views=False, flip=False, size=(500, 400), zoom=1.5, 
                 background=(1, 1, 1), label_text=None, brightness=.5)

Source from the content-addressed store, hash-verified

221 Neither `surf_lh` or `surf_rh` are provided
222 """
223 def __init__(self, surf_lh=None, surf_rh=None, layout='grid', views=None,
224 mirror_views=False, flip=False, size=(500, 400), zoom=1.5,
225 background=(1, 1, 1), label_text=None, brightness=.5):
226 hemi_inputs = zip(['left', 'right'], [surf_lh, surf_rh])
227 self.surfaces = {k: _check_surf(v)
228 for k, v in hemi_inputs if v is not None}
229
230 if len(self.surfaces) == 0:
231 raise ValueError('No surfaces are provided')
232
233 if views == None:
234 views = ['lateral', 'medial']
235 self.plot_layout = _set_layout(surf_lh, surf_rh, layout, views,
236 mirror_views)
237 self.flip = flip
238
239 # plot_surf args
240 self.size = size
241 self.zoom = zoom
242 self.background = background
243 self.label_text = label_text
244
245 # these are updated with each overlay
246 self.layers, self.cmaps, self.color_ranges = [], [], []
247 self._show_cbar, self.cbar_labels = [], []
248
249 # add gray surface default:
250 backdrop = np.ones(sum([v.n_points for v in self.surfaces.values()]))
251 brightness = 1e-6 if brightness == 0 else brightness
252 backdrop *= brightness
253 self.add_layer(backdrop, 'Greys_r', color_range=(0, 1), cbar=False)
254
255 def add_layer(self, data, cmap='viridis', alpha=1, color_range=None,
256 as_outline=False, zero_transparent=True, cbar=True,

Callers

nothing calls this directly

Calls 3

add_layerMethod · 0.95
_check_surfFunction · 0.85
_set_layoutFunction · 0.85

Tested by

no test coverage detected