def setup_default(self):
"""Setup a default colormap
Creates a ColorTransferFunction including 10 gaussian layers whose
colors sample the 'spectral' colormap. Also attempts to scale the
transfer function to produce a natural contrast ratio.
"""
if LooseVersion(matplotlib.__version__) < LooseVersion('2.0.0'):
colormap_name = 'spectral'
else:
colormap_name = 'nipy_spectral'
self.tf.add_layers(10, colormap=colormap_name)
factor = self.tf.funcs[-1].y.size / self.tf.funcs[-1].y.sum()
self.tf.funcs[-1].y *= 2*factor
评论列表
文章目录