def count_blue_red(buf):
    """
    Counts the number of "blue" vs. "red" pixels in the plot area.

    :param buf: The plot pixels read into a buffer of RGB values (
        one-dimensional, [r,g,b,r,g,b,...]).

    :type buf: numpy.ndarray

    :returns: tuple -- The number of blue and red pixels, respectively.  Blue
        represent pixels that have plot data in them, red represent background
        pixels that do not have any plot lines going through them.
    """
    blue_count = 0
    red_count = 0
    for i in range(0, len(buf), 3):
        if not (buf[i] == buf[i + 1] and buf[i] == buf[i + 2]):
            if buf[i] > 0 and buf[i + 2] == 0:
                red_count += 1
            elif buf[i + 2] > 0:
                blue_count += 1
    return blue_count, red_count
