'Update the pixmap if its construction arguments changed.'

def _update_pixmap(self):

    if (self.__data is not None):
        if (self.__colortable is not None):
            lut = self.__colortable
        else:
            lut = None
        (argb, _) = pg.makeARGB(self.__data, lut=lut, levels=self.__levels, scale=250)
        argb[np.isnan(self.__data)] = (100, 100, 100, 255)
        qimage = pg.makeQImage(argb, transpose=False)
        self.__pixmap = QPixmap.fromImage(qimage)
        avg = np.nanmean(self.__data, axis=1, keepdims=True)
        (argb, _) = pg.makeARGB(avg, lut=lut, levels=self.__levels, scale=250)
        qimage = pg.makeQImage(argb, transpose=False)
        self.__avgpixmap = QPixmap.fromImage(qimage)
    else:
        self.__pixmap = QPixmap()
        self.__avgpixmap = QPixmap()
    self.heatmap_item.setPixmap(self.__pixmap)
    self.averages_item.setPixmap(self.__avgpixmap)
    hmsize = QSizeF(self.__pixmap.size())
    avsize = QSizeF(self.__avgpixmap.size())
    self.heatmap_item.setMinimumSize(hmsize)
    self.averages_item.setMinimumSize(avsize)
    self.heatmap_item.setPreferredSize((hmsize * 10))
    self.averages_item.setPreferredSize((avsize * 10))
    self.layout().invalidate()
