Repository: nilearn/nilearn

Issue:
Error when using plot_connectome to plot negative connectivity (and setting edge_vmax < 0)
<!--Provide a brief description of the bug.-->

For `plotting.plot_connectome(...)`, I was interested in plotting a matrix with only negative edges. However, when you set the `edge_vmin` parameter to be less than zero, it raises an error. I propose PR #3390.

For example, the code below raises the error further below. 

```Python
import numpy as np
from nilearn import plotting

if __name__ == '__main__':
    plotting.plot_connectome(np.array([[0, -2.5], [-2.5, 0]]),
                             node_coords=np.array([[0, 0, 0], [50, 50, 50]]),
                             edge_vmin=-3,
                             edge_vmax=-1,
                             colorbar=True)
    plotting.show()
```

```Python
Traceback (most recent call last):
  File "E:/Users/paulc/PycharmProjects/ConnSearch/test_nilearn.py", line 5, in <module>
    plotting.plot_connectome(np.array([[0, -2.5], [-2.5, 0]]),
  File "C:\Users\paulc\Anaconda3\lib\site-packages\nilearn\plotting\img_plotting.py", line 1208, in plot_connectome
    display.add_graph(adjacency_matrix, node_coords,
  File "C:\Users\paulc\Anaconda3\lib\site-packages\nilearn\plotting\displays\_projectors.py", line 212, in add_graph
    ax._add_lines(line_coords, adjacency_matrix_values, edge_cmap,
  File "C:\Users\paulc\Anaconda3\lib\site-packages\nilearn\plotting\displays\_axes.py", line 555, in _add_lines
    linewidth = 1 + 2 * abs_norm(abs_line_value)
  File "C:\Users\paulc\AppData\Roaming\Python\Python38\site-packages\matplotlib\colors.py", line 1193, in __call__
    raise ValueError("minvalue must be less than or equal to maxvalue")
ValueError: minvalue must be less than or equal to maxvalue
```

The error comes `_axes.py`. The issue arises earlier than the actual error on line 555. I think this earlier line is the problem:

``` Python
abs_norm = Normalize(vmin=0, vmax=vmax)
```

Because `vmax < 0`, then `vmax < vmin` when defining `abs_norm` above. This causes `linewidth = 1 + 2 * abs_norm(abs_line_value)` to error.

Currently, `abs_norm` takes some x (a connectivity edge weight) and returns `(abs_line_value - 0)/vmax`, except when it errors. From what I can tell, `abs_norm(abs_line_value)` is meant to essentially represent the magnitude of abs_line_value relative to the highest magnitude specified by the user.  My updated code does while accounting for cases where `vmax < 0` and `abs(vmin) > abs(vmax)`. Here is my updated code, which fixes the bug:

```Python
abs_norm = Normalize(vmin=0, vmax=max(abs(vmax), abs(vmin)))
```

After this fix, the error disappears. This image shows the new output of my initial example above, and the output is as expected: https://imgur.com/jrPKbep

Nilearn version: 0.9.0

### Expected behavior

It should plot the connectivity matrix of negative edges.

### Actual behavior

It errors.

### Steps and code to reproduce bug

I provide example code above.



Discussion:

Resolving patch:
diff --git a/nilearn/plotting/displays/_axes.py b/nilearn/plotting/displays/_axes.py
--- a/nilearn/plotting/displays/_axes.py
+++ b/nilearn/plotting/displays/_axes.py
@@ -523,7 +523,7 @@ def _add_lines(self, line_coords, line_values, cmap,
         norm = Normalize(vmin=vmin, vmax=vmax)
         # normalization useful for colorbar
         self.norm = norm
-        abs_norm = Normalize(vmin=0, vmax=vmax)
+        abs_norm = Normalize(vmin=0, vmax=max(abs(vmax), abs(vmin)))
         value_to_color = plt.cm.ScalarMappable(norm=norm, cmap=cmap).to_rgba
 
         # Allow lines only in their respective hemisphere when appropriate


Test patch:
diff --git a/nilearn/plotting/tests/test_displays.py b/nilearn/plotting/tests/test_displays.py
--- a/nilearn/plotting/tests/test_displays.py
+++ b/nilearn/plotting/tests/test_displays.py
@@ -66,8 +66,8 @@ def test_glass_brain_axes():
     """Tests for class ``GlassBrainAxes``."""
     from nilearn.plotting.displays import GlassBrainAxes
     ax = plt.subplot(111)
-    axes = GlassBrainAxes(ax, 'l', 2)
-    axes._add_markers(np.array([[0, 0, 0]]), 'r', [10])
+    axes = GlassBrainAxes(ax, 'r', 2)
+    axes._add_markers(np.array([[0, 0, 0]]), 'g', [10])
     line_coords = [np.array([[0, 0, 0],
                              [1, 1, 1]])]
     line_values = np.array([1, 0, 6])
@@ -79,7 +79,7 @@ def test_glass_brain_axes():
                        match="If vmin is set to a non-negative number "):
         axes._add_lines(line_coords, line_values, None, vmin=10, vmax=None)
     axes._add_lines(line_coords, line_values, None, vmin=-10, vmax=None)
-
+    axes._add_lines(line_coords, line_values, None, vmin=-10, vmax=-5)
 
 def test_get_index_from_direction_exception():
     """Tests that a ValueError is raised when an invalid direction