def set_component(self, component):

        if self._component is component:
            return

        self._sync_enabled = False

        iscat = lambda x: x.categorical

        def comp_obj():
            # the current Component (not ComponentID) object
            x = list(self._get_data_components('x'))
            if x:
                x = x[0]
            return x

        prev = comp_obj()
        old = self.nbins

        first_add = self._component is None
        self._component = component
        cur = comp_obj()

        if self.component in self._xlog_cache:
            self.xlog = self._xlog_cache[self.component]
        else:
            self.xlog = False
            self._xlog_cache[self.component] = self.xlog

        if (self.xlog, self.component) in self._xlim_cache:
            self.xmin, self.xmax = self._xlim_cache[(self.xlog, self.component)]
        else:
            self._auto_limits()
            self._xlim_cache[(self.xlog, self.component)] = self.xmin, self.xmax

        self._sync_enabled = True

        if first_add or iscat(cur):
            self._auto_nbin()

        # save old bins if switch from non-category to category
        if prev and not iscat(prev) and iscat(cur):
            self._saved_nbins = old

        # restore old bins if switch from category to non-category
        if prev and iscat(prev) and cur and not iscat(cur) and self._saved_nbins is not None:
            self.nbins = self._saved_nbins
            self._saved_nbins = None

        self.sync_all()
        self._relim()
Redefine which component gets plotted
dataset/ETHPy150Open glue-viz/glue/glue/viewers/histogram/client.py/HistogramClient.set_component