I've read that using log scales when charting/graphing is appropriate in certain circumstances, like the y-axis in a time series chart. However, I've not been able to find a definitive explanation as to why that's the case, or when else it would be appropriate. Please keep in mind, I'm not a statistician so I may be missing the point altogether and if that's the case I'd appreciate direction to remedial resources.

  • 10
    $\begingroup$ This is not a formal answer but - when a variable spans several orders of magnitude it is often easier on the eyes (and more informative) to visualize it on the log scale. $\endgroup$ – Macro May 7 '12 at 13:14
  • $\begingroup$ Macro-that makes good sense (especially when you've got an audience that can understand it!) $\endgroup$ – dav May 7 '12 at 19:19
  • 1
    $\begingroup$ You may find this closely related thread of use while you are waiting for specific replies: stats.stackexchange.com/questions/298. In terms of charting, you may fruitfully interpret "dependent variable" as "y axis". Then take a look at the many closely related questions which have appeared here. $\endgroup$ – whuber May 7 '12 at 21:06
  • 4
    $\begingroup$ Also FYI Naomi Robbins has a very straightforward article on the topic as well that should be of interest, When Should I Use Logarithmic Scales in My Charts and Graphs?. $\endgroup$ – Andy W May 10 '12 at 14:46
  • $\begingroup$ Whuber, thanks for pointing out the extra links. I had seen some of those, but not all and I'm working my way through them now. $\endgroup$ – dav May 14 '12 at 16:37

This is a very interesting question, and one that too few people think about. There are several different ways that a log scale can be appropriate. The first and most well known is that mentioned by Macro in his comment: log scales allow a large range to be displayed without small values being compressed down into bottom of the graph.

A different reason for preferring a log scaling is in circumstances where the data are more naturally expressed geometrically. An example is when the data represent concentration of a biological mediator. Concentrations cannot be negative and the variability almost invariably scales with the mean (i.e. there is heteroscedastic variance). Using a logarithmic scale or, equivalently, using the log concentration as the primary measure both 'fixe' the uneven variability and gives a scale that is unbounded on both ends. The concentrations are probably log-normally distributed and so a log scaling gives us a very convenient result that is arguably 'natural'. In pharmacology we use a logarithmic scale for drug concentrations far more often than not, and in many cases linear scales are only the product of non-pharmacologists dabbling with drugs ;-)

Another good reason for a log scale, probably the one that you are interested in for time-series data, comes from the ability of a log scale to make fractional changes equivalent. Imagine a display of the long-term performance of your retirement investments. It (should) be growing roughly exponentially because tomorrow's interest depends on today's investment (roughly speaking). Thus even if the performance in percentage terms has been fairly constant a graph of the funds will appear to have grown most rapidly at the right hand end. With a logarithmic scale a constant percentage change is seen as a constant vertical distance so a constant growth rate is seen as a straight line. That is often a substantial advantage.

Another slightly more esoteric reason for choosing a log scale comes in circumstances where values can be reasonably expressed either as x or 1/x. An example from my own research is vascular resistance which can also be sensibly expressed as the reciprocal, vascular conductance. (It is also sensible in some circumstances to think of the diameter of the blood vessels which scale as a power of resistance or conductance.) Neither of those measures has any more reality than the other and both can be found in research papers. If they are scaled logarithmically then they are simply the negative of each other and the choice of one or the other makes no susbstantive difference. (Vascular diameter will differ from resistance and conductance by a constant multiplier when they are all log scaled.)

  • $\begingroup$ Thanks for the great answer! Can you elaborate on "values can be reasonably expressed as x", though? $\endgroup$ – ktdrv May 7 '12 at 22:13
  • 4
    $\begingroup$ @ktdrv Some things make sense either way up. Say you want to document the ability of a fisherman. You can count the number of fish caught per day or you can measure the interval between successive catches. Either measurement makes sense but they are non-linearly related to each other. They are scaled reciprocals of each other and so can be one-to-one converted to the other. The log of the interval and the log of the number per day are linearly related to each other and differ by a constant (negative) factor. $\endgroup$ – Michael Lew May 8 '12 at 2:07
  • 1
    $\begingroup$ Michael, thanks for the great answer. I have to admit, it took me a while to sift through all your points (and had to google a few terms, like "heteroscedastic variance"). I'm still piecing together exactly what the real impact of the answer will mean to my work, but I'm grateful for a general direction and some guidelines to point me along the way. $\endgroup$ – dav May 14 '12 at 16:18
  • $\begingroup$ Re the last paragraph: Two major reasons for re-expressing values are to stabilize variances and to linearize relationships with other variables. It's almost always the case that when $x$ works, $1/x$ will be horrible, and vice versa. Therefore, using $\log(x)$ because it creates a linear relationship between $x$ and $1/x$ does not seem defensible: if it works, that means neither $x$ nor $1/x$ is an effective expression of the values and otherwise it doesn't work and you should determine which of $x$ or $1/x$ (or some other re-expression) is appropriate. $\endgroup$ – whuber May 17 '12 at 21:16
  • 1
    $\begingroup$ "In pharmacology we use a logarithmic scale for drug concentrations far more often than not": let me emphasize that by adding that that variables are actually frequently already defined that way, e.g. $pH = -log [H^+]$. The being expressed that way more naturally means that many relationships become much easier (linear) expressions with the log there. $\endgroup$ – cbeleites unhappy with SX Jun 19 '12 at 12:22

Some real life examples I had to hand as an addition to @Michael Lew's very good answer.

First, the two time series plots below show monthly visitor arrivals to New Zealand, available from Statistics New Zealand. Both plots have their purpose, but I find the one with the vertical axis on a logarithmic scale spectacularly useful for many more purposes than the first one. For example, you can see that the seasonality in arrivals stays roughly proportional to the scale of the arrivals; and you can see the significant changes in growth rate (eg during the second world war) which are just invisible on the original scale.

enter image description here

Second, the plots below show total trip-related spend by tourists to New Zealand, compared to the spend while they are actually in New Zealand. The source is the International Visitors Survey by Ministry of Economic Development. The difference is pre-trip expenditure, eg hotels or packages paid in advance. The first plot, on the original scale, can be used for few purposes other than a very crude (but important) impression of the data being grouped in the bottom left corner. The second plot sacrifices some immediate interpretability, particularly for non-statisticians (because of this, I would normally now actually use a logarithmic scale on the axes, rather than transform the data and have the scale showing the logarithmic value), but gives a lot more visual differentiation.

For example, you can clearly spot the few outliers (which turned out to be data editing errors) where total spend was less than spend in New Zealand. Perhaps more importantly, you could use this graph with different colors or faceting to show how different market countries or purpose of visit (eg holiday v. visiting friends and family) occupy different parts of the expenditure "space" - something that would just be invisible on the original axes.

Turning this plot into something useful would involve somehow dealing with the high density data (eg by adding some transparency to the points, or replacing points with hexagonal bins colored according to density) but any useful visual solution will almost certainly involve logarithmic axes.

enter image description here

edit / addition

Another plot to illustrate what I meant by the hexagonal bins, using color to represent density when there is a large dataset (in this case, about 12000 respondents to a survey about Rugby World Cup experiences in New Zealand). Note again this is another example where I've used a logarithmic scale for expenditure.

enter image description here

  • $\begingroup$ Peter, thanks for the additional insight-the graphics really help with understanding your points. One follow-up question (if you're so inclined), why would you replace points with "hexagonal" bins? Is that the same idea as "Sunflower Plots"? I've not heard that term before. $\endgroup$ – dav May 14 '12 at 16:23
  • $\begingroup$ No, different to sunflower plots. The point is to divide the plotting area into hexagonal bins and then color them (eg from light to dark) according to how many points are in each bin. Can be a good way to get around plotting large datasets which otherwise have a tendency just to turn into a mass of black. $\endgroup$ – Peter Ellis May 14 '12 at 18:53
  • $\begingroup$ (the rest of the comment) @PeterEllis Thanks for the clarification. That's a great way of visualizing the data-its very similar to geographic heat maps that I use. Did you create that in R? $\endgroup$ – dav May 14 '12 at 20:43
  • $\begingroup$ Yes, R, using the ggplot2 package - very good for this purpose and quite straightforward once you've got the basics. $\endgroup$ – Peter Ellis May 14 '12 at 22:38
  • $\begingroup$ (last comment), thanks for the pointer to R. I tried it without too much luck, but was able to get something very similar in Excel using transparencies in the data points, so areas of higher concentration are darker/lower concentration are lighter. $\endgroup$ – dav May 15 '12 at 12:01

One other nifty thing about log scales is that they make ratios appear symmetric. For example, like this: enter image description here

  • 12
    $\begingroup$ It would be nice to see the same plot on a linear scale, for comparison $\endgroup$ – nico May 17 '12 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.