added thresholded colorbar

attemps to adress #231

Here is an example for threshold=5 of what it currently looks like:

![bildschirmfoto 2014-11-25 um 18 53 21](https://cloud.githubusercontent.com/assets/3907396/5191981/85c179e6-74f3-11e4-8def-b032366a3684.png)

Greetings from Berlin
a) I will take out the check for too big threshold choices

b) Any other decisions to take at this point?

2014-12-11 11:04 GMT+01:00 Loïc Estève <notifications@github.com>:

> In nilearn/plotting/displays.py
> <https://github.com/nilearn/nilearn/pull/296#discussion-diff-21667142>:
>
> > @@ -401,8 +402,19 @@ def add_overlay(self, img, threshold=1e-6, colorbar=False, **kwargs):
> >
> >          ims = self._map_show(img, type='imshow', **kwargs)
> >
> > +        if threshold is not None:
> > +            if threshold < 0:
> > +                raise ValueError("The set threshold (%.2f) can't be negative"
> > +                                 % threshold)
> > +            if threshold > ims[0].norm.vmax:
> > +                raise ValueError('The set threshold (%.2f) is higher than '
> > +                                 'vmax (%.2f)' % (threshold, ims[0].norm.vmax))
> > +            if threshold > abs(ims[0].norm.vmax):
> > +                raise ValueError('The set threshold (%.2f) is lower than '
> > +                                 'vmin (%.2f)' % (threshold, ims[0].norm.vmin))
> > +
>
>  Sorry if I missed the point, but for me no error should be raised if the
> threshold is greater than any value of the map: visualizing an empty map is
> a perfectly valid use case.
>
> I kind of agree on this one. I think the grayed cmap logic has to handle
> this case.
>
> Similarly, I don't see immediately why negative thresholds are forbidden
> (maybe I'm missing some context here).
>
> At the moment, the treshold logic is such that values in [-threshold,
> threshold] are masked so it doesn't make too much sense to have a negative
> threshold (full disclosure: currently it may well be the case that
> threshold=-threshold works exactly the same as threshold=threshold by
> accident)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/nilearn/nilearn/pull/296/files#r21667142>.
>



-- 
Viele Grüße,
Danilo