From 6df6aac75613f0d5a54689f17465c20dbf0b923c Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Fri, 11 Nov 2016 15:25:49 +0000
Subject: [PATCH] ColourBarBitmap allows the resolution to be specified (and
 interpolation has been changed to nearest-neighbour)

---
 fsl/utils/colourbarbitmap.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fsl/utils/colourbarbitmap.py b/fsl/utils/colourbarbitmap.py
index 3199b4eef..47b150e2e 100644
--- a/fsl/utils/colourbarbitmap.py
+++ b/fsl/utils/colourbarbitmap.py
@@ -22,7 +22,8 @@ def colourBarBitmap(cmap,
                     alpha=1.0,
                     fontsize=10,
                     bgColour=None,
-                    textColour='#ffffff'):
+                    textColour='#ffffff',
+                    cmapResolution=256):
     """Plots a colour bar using :mod:`matplotlib`.
 
     
@@ -92,7 +93,7 @@ def colourBarBitmap(cmap,
         if labelside == 'left': labelside = 'top'
         else:                   labelside = 'bottom'
 
-    ncols         = 256
+    ncols         = cmapResolution
     dpi           = 96.0
     cmap          = cm.get_cmap(cmap)
     data          = np.linspace(0.0, 1.0, ncols)
@@ -114,7 +115,7 @@ def colourBarBitmap(cmap,
     ax.imshow(data,
               aspect='auto',
               origin='lower',
-              interpolation='bilinear')
+              interpolation='nearest')
 
     ax.set_xlim((0, ncols - 1))
         
-- 
GitLab