# Buggy code
def _get_tick_frac_labels(self):
    # This conditional is currently unnecessary since we only support
    # linear, but eventually we will support others so we leave it in
    if self.axis.scale_type == "linear":
        major_num = 11  # maximum number of major ticks
        minor_num = 4  # maximum number of minor ticks per major division

        major, majstep = np.linspace(0, 1, num=major_num, retstep=True)

        # XXX TODO: this should be better than just str(x)
        labels = [str(x) for x in np.interp(major, [0, 1], self.axis.domain)]

        # XXX TODO: make these nice numbers only
        # - and faster! Potentially could draw in linspace across the whole
        # axis and render them before the major ticks, so the overlap
        # gets hidden. Might be messy. Benchmark trade-off of extra GL
        # versus extra NumPy.
        minor = []
        for i in np.nditer(major[:-1]):
            minor.extend(np.linspace(i, (i + majstep), (minor_num + 2))[1:-1])
    # elif (self.scale_type == 'logarithmic'):
    #     return NotImplementedError
    # elif (self.scale_type == 'power'):
    #     return NotImplementedError
    return major, minor, labels


# Traceback (IndexError)
Traceback (most recent call last):
File "oscilloscope.py", line 138, in on_paint
visual.draw(transform)
File "oscilloscope.py", line 79, in draw
self.program.uniforms['color'] = self.color
File "../vispy/oogl/program_inputs.py", line 43, in __setitem__
self._set(k, v)
File "../vispy/oogl/program_inputs.py", line 94, in _set
self._apply(name, value)
File "../vispy/oogl/program_inputs.py", line 198, in _apply
_name, length, type = gl.glGetActiveUniform(self._program.handle, loc)
File "/usr/locaL/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenGL/latebind.py", line 61, in __call__
return self.wrapperFunction( self.baseFunction, *args, **named )
File "/usr/locaL/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenGL/GL/VERSION/GL_2_0.py", line 213, in glGetActiveUniform
raise IndexError( 'Index %s out of range 0 to %i' % (index, max_index - 1, ) )
IndexError: Index 4 out of range 0 to 1
Error invoking callback for event: <PaintEvent blocked=False handled=False native=None region=None source=<__main__.Canvas object at 0x107548210> sources=[<__main__.Canvas object at 0x107548210>] type=paint>
(0.1, 1.0, 0.1, 1.953125000000001e-11)```

# Fixed code
def _get_tick_frac_labels(self):
    """Get the major ticks, minor ticks, and major labels"""
    minor_num = 4  # number of minor ticks per major division
    if self.axis.scale_type == "linear":
        domain = self.axis.domain
        if domain[1] < domain[0]:
            flip = True
            domain = domain[::-1]
        else:
            flip = False
        offset = domain[0]
        scale = domain[1] - domain[0]

        tr_sys = self.axis.transforms
        length = self.axis.pos[1] - self.axis.pos[0]  # in logical coords
        n_inches = np.sqrt(np.sum(length**2)) / tr_sys.dpi

        # major = np.linspace(domain[0], domain[1], num=11)
        # major = MaxNLocator(10).tick_values(*domain)
        major = _get_ticks_talbot(domain[0], domain[1], n_inches, 2)

        labels = ["%g" % x for x in major]
        majstep = major[1] - major[0]
        minor = []
        minstep = majstep / (minor_num + 1)
        for i in major[:-1]:
            minor.extend(np.linspace(i + minstep, i + majstep - minstep, (minor_num)))
        major_frac = major / scale - offset
        minor_frac = np.array(minor) / scale - offset
        major_frac = major_frac[::-1] if flip else major_frac
        use_mask = (major_frac > -0.0001) & (major_frac < 1.0001)
        major_frac = major_frac[use_mask]
        labels = [l for li, l in enumerate(labels) if use_mask[li]]
        minor_frac = minor_frac[(minor_frac > -0.0001) & (minor_frac < 1.0001)]
    elif self.axis.scale_type == "logarithmic":
        return NotImplementedError
    elif self.axis.scale_type == "power":
        return NotImplementedError
    return major_frac, minor_frac, labels