code: def _rotate_cmap(cmap, swap_order=("green", "red", "blue")):
      """Swap the colors of a colormap."""
      orig_cdict = cmap._segmentdata.copy()
  
      cdict = dict()
      cdict["green"] = [
          (p, c1, c2) for (p, c1, c2) in orig_cdict[swap_order[0]]
      ]
      cdict["blue"] = [
          (p, c1, c2) for (p, c1, c2) in orig_cdict[swap_order[1]]
      ]
      cdict["red"] = [
          (p, c1, c2) for (p, c1, c2) in orig_cdict[swap_order[2]]
      ]
  
      return cdict
  
file_path: nilearn/nilearn/plotting/cm.py
imports: import numpy
  from matplotlib import cm, colors, rcParams
label_desc: Use image node_id 2 for calling a global function with example usage: _rotate_cmap(cmap, swap_order) and returns: cdict