move tooltip code into main plot function for clarity