def METHOD_NAME(self, button):
    if DEBUG:
        print("active:", [b.plotname for b in self.active_buttons])
        print("new button selected:", button.plotname)
    if button in self.active_buttons:
        return
    numbuttons = len(self.active_buttons)
    if numbuttons == 0:
        self.active_buttons.append(button)
        button.show_overlay()
    elif numbuttons == 1:
        self.active_buttons[0].hide_overlay()
        self.active_buttons.append(button)
        self.show_scatterplot(*self.active_buttons)
    elif numbuttons == 2:
        # Replace the last active button with the new one
        self.active_buttons[1].button_state = "up"
        self.active_buttons[1] = button
        self.hide_scatterplot()
        self.show_scatterplot(*self.active_buttons)
    else:
        return
    button.button_state = "down"