R tips and tricks – the locator function

How many times have you placed the legend in R plot to discover it is being overrun by some points or lines in the chart? Usually what comes next is a trial-and-error phase where you adjust the location, changing the arguments of the x and y coordinates, and re-drawing the plot again to check if the legend or text are now positioned such that they are fully readable.

With the locator function you can do that more efficiently. Usually I have some charts at this point, but due to the interactive nature of this function I had to make short youtube.

How to use the locator function? (click play)


Code used:

Leave a Reply

Your email address will not be published. Required fields are marked *