(self, minVal, maxVal, size)
return [(spacing, ticks)]
Find appropriate tick locations.
Find appropriate tick locations.
Find appropriate tick locations .
def tickValues(self, minVal, maxVal, size):
        """Find appropriate tick locations."""
        if not self._use_time:
            return super().tickValues(minVal, maxVal, size)

        # if timezone is not set, then local is used which cause exceptions
        minVal = max(minVal,
                     datetime.min.replace(tzinfo=timezone.utc).timestamp() + 1)
        maxVal = min(maxVal,
                     datetime.max.replace(tzinfo=timezone.utc).timestamp() - 1)
        mn = utc_from_timestamp(minVal).timetuple()
        mx = utc_from_timestamp(maxVal).timetuple()
        try:
            bins = _time_binnings(mn, mx, 6, 30)[-1]
        except (IndexError, ValueError):
            # cannot handle very large and very small time intervals
            return super().tickValues(minVal, maxVal, size)

        ticks = bins.thresholds

        max_steps = max(int(size / self._label_width), 1)
        if len(ticks) > max_steps:
            # remove some of ticks so that they don't overlap
            step = int(np.ceil(float(len(ticks)) / max_steps))
            ticks = ticks[::step]

        spacing = min(b - a for a, b in zip(ticks[:-1], ticks[1:]))
        return [(spacing, ticks)]
def tickValues ( self , minVal , maxVal , size ) : if not self . _use_time : return super ( ) . tickValues ( minVal , maxVal , size ) # if timezone is not set, then local is used which cause exceptions minVal = max ( minVal , datetime . min . replace ( tzinfo = timezone . utc ) . timestamp ( ) + 1 ) maxVal = min ( maxVal , datetime . max . replace ( tzinfo = timezone . utc ) . timestamp ( ) - 1 ) mn = utc_from_timestamp ( minVal ) . timetuple ( ) mx = utc_from_timestamp ( maxVal ) . timetuple ( ) try : bins = _time_binnings ( mn , mx , 6 , 30 ) [ - 1 ] except ( IndexError , ValueError ) : # cannot handle very large and very small time intervals return super ( ) . tickValues ( minVal , maxVal , size ) ticks = bins . thresholds max_steps = max ( int ( size / self . _label_width ) , 1 ) if len ( ticks ) > max_steps : # remove some of ticks so that they don't overlap step = int ( np . ceil ( float ( len ( ticks ) ) / max_steps ) ) ticks = ticks [ : : step ] spacing = min ( b - a for a , b in zip ( ticks [ : - 1 ] , ticks [ 1 : ] ) ) return [ ( spacing , ticks ) ]