def _maketicks_selected(self, plt, branches):
        """
        utility private method to add ticks to a band structure with selected branches
        """
        ticks = self.get_ticks()
        distance = []
        label = []
        rm_elems = []
        for i in range(1, len(ticks['distance'])):
            if ticks['label'][i] == ticks['label'][i - 1]:
                rm_elems.append(i)
        for i in range(len(ticks['distance'])):
            if i not in rm_elems:
                distance.append(ticks['distance'][i])
                label.append(ticks['label'][i])
        l_branches = [distance[i] - distance[i - 1] for i in
                      range(1, len(distance))]
        n_distance = []
        n_label = []
        for branch in branches:
            n_distance.append(l_branches[branch])
            if ("$\\mid$" not in label[branch]) and (
                "$\\mid$" not in label[branch + 1]):
                n_label.append([label[branch], label[branch + 1]])
            elif ("$\\mid$" in label[branch]) and (
                "$\\mid$" not in label[branch + 1]):
                n_label.append(
                    [label[branch].split("$")[-1], label[branch + 1]])
            elif ("$\\mid$" not in label[branch]) and (
                "$\\mid$" in label[branch + 1]):
                n_label.append([label[branch], label[branch + 1].split("$")[0]])
            else:
                n_label.append([label[branch].split("$")[-1],
                                label[branch + 1].split("$")[0]])

        f_distance = []
        rf_distance = []
        f_label = []
        f_label.append(n_label[0][0])
        f_label.append(n_label[0][1])
        f_distance.append(0.0)
        f_distance.append(n_distance[0])
        rf_distance.append(0.0)
        rf_distance.append(n_distance[0])
        length = n_distance[0]
        for i in range(1, len(n_distance)):
            if n_label[i][0] == n_label[i - 1][1]:
                f_distance.append(length)
                f_distance.append(length + n_distance[i])
                f_label.append(n_label[i][0])
                f_label.append(n_label[i][1])
            else:
                f_distance.append(length + n_distance[i])
                f_label[-1] = n_label[i - 1][1] + "$\\mid$" + n_label[i][0]
                f_label.append(n_label[i][1])
            rf_distance.append(length + n_distance[i])
            length += n_distance[i]

        n_ticks = {'distance': f_distance, 'label': f_label}
        uniq_d = []
        uniq_l = []
        temp_ticks = list(zip(n_ticks['distance'], n_ticks['label']))
        for i in range(len(temp_ticks)):
            if i == 0:
                uniq_d.append(temp_ticks[i][0])
                uniq_l.append(temp_ticks[i][1])
                logger.debug("Adding label {l} at {d}".format(
                    l=temp_ticks[i][0], d=temp_ticks[i][1]))
            else:
                if temp_ticks[i][1] == temp_ticks[i - 1][1]:
                    logger.debug("Skipping label {i}".format(
                        i=temp_ticks[i][1]))
                else:
                    logger.debug("Adding label {l} at {d}".format(
                        l=temp_ticks[i][0], d=temp_ticks[i][1]))
                    uniq_d.append(temp_ticks[i][0])
                    uniq_l.append(temp_ticks[i][1])

        logger.debug("Unique labels are %s" % list(zip(uniq_d, uniq_l)))
        plt.gca().set_xticks(uniq_d)
        plt.gca().set_xticklabels(uniq_l)

        for i in range(len(n_ticks['label'])):
            if n_ticks['label'][i] is not None:
                # don't print the same label twice
                if i != 0:
                    if n_ticks['label'][i] == n_ticks['label'][i - 1]:
                        logger.debug("already print label... "
                                     "skipping label {i}".format(
                            i=n_ticks['label'][i]))
                    else:
                        logger.debug("Adding a line at {d}"
                                     " for label {l}".format(
                            d=n_ticks['distance'][i], l=n_ticks['label'][i]))
                        plt.axvline(n_ticks['distance'][i], color='k')
                else:
                    logger.debug("Adding a line at {d} for label {l}".format(
                        d=n_ticks['distance'][i], l=n_ticks['label'][i]))
                    plt.axvline(n_ticks['distance'][i], color='k')

        shift = []
        br = -1
        for branch in branches:
            br += 1
            shift.append(distance[branch] - rf_distance[br])

        return plt, shift