Search code examples
rplotloglog

Log Log Plot - How to make sense of the axis


I am having a small issue making sense of a log-log plot. So if I create an x-y plot by the following:

xx <- exp(1:10)
yy <- exp(1:10)
plot(xx,yy)

The highest value is 22026.47. When I then plot it on as a log-log plot (this is purely a basic example), as per below

   plot(xx,yy, log="yx")

the highest co-ordinate is over 5000. Can someone point me in the right direction to interpret this? For example how can I get the value by which 22026.47 is transformed.

enter image description here


Solution

  • I am not entirely sure what you are asking in regards to "the value by which 22026.47 is transformed". You can simply take the log of whatever value to get it, if that is what you are asking. Unsurprisingly:

    log(22026.47) 
    #[1] 10
    

    Anyway, perhaps some confusion stems from the fact that the log="xy" argument to plot plots your data on a log scale but with ticks marks and labels on the original scale. You say the highest coordinates is over 5000, but 22026.47 is over 5000 so that fits well. The two are just close on a log-scale; just as close as 2.72 and 7.39 corresponding to xx[1:2].

    Compare your log-log plot with the result of

    plot(log(xx), log(yy))
    

    Here you are plotting the actual log-values of your data, and that is also reflected in your x-axis and y-axis labels.