Enhanced the function to extract data and plot it with different annotations