def _maketicks(self, plt):
        """
        utility private method to add ticks to a band structure
        """
        ticks = self.get_ticks()
        # Sanitize only plot the uniq values
        uniq_d = []
        uniq_l = []
        temp_ticks = list(zip(ticks['distance'], 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(ticks['label'])):
            if ticks['label'][i] is not None:
                # don't print the same label twice
                if i != 0:
                    if ticks['label'][i] == ticks['label'][i - 1]:
                        logger.debug("already print label... "
                                     "skipping label {i}".format(
                            i=ticks['label'][i]))
                    else:
                        logger.debug("Adding a line at {d}"
                                     " for label {l}".format(
                            d=ticks['distance'][i], l=ticks['label'][i]))
                        plt.axvline(ticks['distance'][i], color='k')
                else:
                    logger.debug("Adding a line at {d} for label {l}".format(
                        d=ticks['distance'][i], l=ticks['label'][i]))
                    plt.axvline(ticks['distance'][i], color='k')
        return plt
def _maketicks ( self , plt ) : ticks = self . get_ticks ( ) uniq_d = [ ] uniq_l = [ ] temp_ticks = list ( zip ( ticks [ 'distance' ] , 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 ( ticks [ 'label' ] ) ) : if ticks [ 'label' ] [ i ] is not None : if i != 0 : if ticks [ 'label' ] [ i ] == ticks [ 'label' ] [ i - 1 ] : logger . debug ( "already print label... " "skipping label {i}" . format ( i = ticks [ 'label' ] [ i ] ) ) else : logger . debug ( "Adding a line at {d}" " for label {l}" . format ( d = ticks [ 'distance' ] [ i ] , l = ticks [ 'label' ] [ i ] ) ) plt . axvline ( ticks [ 'distance' ] [ i ] , color = 'k' ) else : logger . debug ( "Adding a line at {d} for label {l}" . format ( d = ticks [ 'distance' ] [ i ] , l = ticks [ 'label' ] [ i ] ) ) plt . axvline ( ticks [ 'distance' ] [ i ] , color = 'k' ) return plt
utility private method to add ticks to a band structure