parameters: (size, color_map)
return_statement: return QtGui.QIcon(pixmap)
docstring: Creates a QIcon representing the color map as a horizontal gradient.
docstring_summary: Creates a QIcon representing the color map as a horizontal gradient.
docstring_tokens: Creates a QIcon representing the color map as a horizontal gradient .
function: def create_color_map_icon(size, color_map):
      """Creates a QIcon representing the color map as a horizontal gradient."""
      color_map.data_range = [0, 1]
      samples = np.linspace(0.0, 1.0, size.width())
      image = QtGui.QImage(size.width(), 1, QtGui.QImage.Format_RGB32)
      for i in range(size.width()):
          [r, g, b] = color_map.get_color(samples[i])
          rgb = QtGui.QRgba64.fromRgba(int(r * 255), int(g * 255),
                                       int(b * 255), 255).toArgb32()
          image.setPixel(i, 0, rgb)
      pixmap = QtGui.QPixmap()
      pixmap.convertFromImage(image.scaled(size))
      return QtGui.QIcon(pixmap)
function_tokens: def create_color_map_icon ( size , color_map ) : color_map . data_range = [ 0 , 1 ] samples = np . linspace ( 0.0 , 1.0 , size . width ( ) ) image = QtGui . QImage ( size . width ( ) , 1 , QtGui . QImage . Format_RGB32 ) for i in range ( size . width ( ) ) : [ r , g , b ] = color_map . get_color ( samples [ i ] ) rgb = QtGui . QRgba64 . fromRgba ( int ( r * 255 ) , int ( g * 255 ) , int ( b * 255 ) , 255 ) . toArgb32 ( ) image . setPixel ( i , 0 , rgb ) pixmap = QtGui . QPixmap ( ) pixmap . convertFromImage ( image . scaled ( size ) ) return QtGui . QIcon ( pixmap )