I have just found a magic keyword thanks to this SO post. The following works as desired:
plt = scatter(input, output, label = "data", clip_mode = "individual")
plot!(plt, input, output, label = "theory")
The clip_mode argument has to be passed to the first call in order to work.