7. Graphs on Logarithmic and Semi-Logarithmic Axes
by M. Bourne
Need Graph Paper?
Download graph paper, including
log-log and semi-log.
In a semilogarithmic graph, one axis has a logarithmic scale and the other axis has a linear scale.
In log-log graphs, both axes have a logarithmic scale.
The idea here is we use semilog or log-log graph axes so we can more easily see details for small values of y as well as large values of y.
You can see some examples of semi-logarithmic graphs in this YouTube Traffic Rank graph and in this article on loudspeakers (external site). See also air pressure and Zipf Distributions later on this page.
In the following set of axes, the vertical scale is logarithmic (equal scale between powers of 10) and the horizontal scale is linear (even spaces between numbers).
There are no negative numbers on the y-axis, since we can only find the logarithm of positive numbers.
NOTE: The numbers on the y-axis become too close together near each integral power of 10, so they have been removed for readability.
Example 1: Graph of `y=x`
Let's see what the simple graph `y=x` looks like on different axis types.
a. `y=x` on Linear Axes
On ordinary linear axes, the graph of `y=x` is a straight line, passing through `(-2,-2)`, `(-1,-1)`, `(0,0)`, `(1,1)`, `(2,2)`, etc.
b. `y=x` on Semi-logarithmic Axes (vertical axis logarithmic, horizontal axis linear)
On semi-logarithmic axes, the graph of `y=x` is a curve, not a straight line. It still passes through `(1,1)`, `(2,2)`, `(3,3)`, etc, but you'll notice there are no negative values for `y` (and so in this case, no negative values for `x` either) since we can't find the log of a negative number.
I've marked the points `(1,1)`, `(2,2)`, `(3,3)`, `(4,4)` `(5,5)`, `(6,6)` on the curve.
c. `y=x` on Semi-logarithmic Axes (vertical axis linar, horizontal axis logarithmic)
I've marked the points `(1,1)`, `(2,2)`, `(3,3)` up to `(10,10)` on the curve.
Notice there are no negative values for `x` on a lin-log curve.
Example 2: Variable Exponent
We conducted some observations in an experiment involving growth of a microbial population at different temperatures and obtained data as follows:
We observe the population increases by 7 times for each `1°` rise in temperature, so we can model the data using the function `P = 7^T`.
We plot the data on linear T-P axes as follows:
Our plot shows reasonable detail for values of `x` greater than `1`, but doesn't tell us much for smaller values of `x` or `y`. The points are too close to the x-axis for us to see what is going on.
Let's now plot the same data on semi-logarithmic axes.
Now we can see a lot more information for smaller values of `x` and `y`. This is the beauty of semi-logarithmic axis plots - you can see more detail in graphs where there is a very wide range of values, but some of the data is close together.
Draw the graphs of `y=5^x` on linear and both types of semilogarithmic axes.
Log-log graphs use a logarithmic scale for both vertical and horizontal axes.
Here's the graph of `y=x` on log-log axes.
Points along the line `y=x` on log-log axes.
The above graph has the following points highlighted for clarity:
`(1, 1)`, `(2, 2)`, `(3, 3)`,..., `(10, 10)`, and `(100, 100)`.
NOTE: Both the domain (x-values) and the range (y-values) must be POSITIVE, because you cannot have the logarithm of a negative number.
We can also graph the population example we met earlier, `P = 7^T` on log-log paper (i.e. both axes use log scales):
Points along the curve `P=7^T` on log-log axes.
We can see even more detail for small values of x and y now, however we can't include the negative temperatures on the horizontal axis.
Example 4: Variable Raised to a Fractional Exponent
Graph y = x1/2 using all 4 axis types (rectangular, both types of semi-log, and log-log). This function is equivalent to `y=sqrt(x)`.
Application 1: Air pressure
1. By pumping, the air pressure in a tank is reduced by 18% each second. So the percentage of air pressure remaining at time `t` is given by p = 100(0.82)t.
Plot p against t for 0 < t < 30 s on
(a) a rectangular co-ordinate system
(b) a semilogarithmic system.
Application 2: Zipf Distributions
Consider the most common words in English. It turns out that there is a relationship between the rank of a word's occurrence and the frequency of its use. That relationship was observed by George Kingsley Zipf in the first half of the 20th century.
The Zipf Distribution is an observation comparing rank and frequency of word occurrences. In general, the word with rank k has a frequency roughly proportional to `1/k`. In other words, the second most commonly used word occurs about `1/2` as often as the most common word. Likewise, the 3rd most common word occurs about `1/3` as often as the most common word.
Zipf Distributions occur naturally in many situations, for example in:
- Calls to computer operating systems
- Colors in images
- As the basis of most approaches to image compression
- City populations (a small number of large cities, a larger number of smaller cities)
- Wealth distribution (a small number of people have large amounts of money, large numbers of people have small amounts of money)
- Company size distribution
- Artificial intelligence (in particular, "chat bots" that can chat with humans) relies on the limited number of questions and statements that people actually write in chats. (See ALICE).
a. Common English Words
Zipf originally developed his law in response to the observation that the frequency of words was inversely proportional to the rank of each word.
For example, the most common 20 words in English are listed in the following table. The table is based on the Brown Corpus, a careful study of a million words from a wide variety of sources including newspapers, books, magazines, fiction, government documents, comedy and academic publications.
The most common word, "the" occurred around `70,000` times (or `7%` of the million words counted). The next ranked word, "of", occurred around `3.6%` of the time (or about `1/2` as often as the top-ranked word.) The third most popular word was "and", with a frequency of `2.8%`, or roughly `1/3` of the frequency of the top ranked word.
|Rank||Word||Frequency||% Frequency||Theoretical Zipf
(The first 20 words in the Brown Corpus, published in 1967. This Corpus is the count of how often one million words were used in a variety of books, newspapers and other publications. [Table source no longer available, but similar to Corpus of Contemporary American English.]
I have included the "Theoretical Zipf Distribution, based on the n-th ranked word occurring approximately `1/n` times the frequency of the highest ranked word. This gives us a hyperbola, that we met before.)
Let's plot what we have observed:
The dark blue data points represent the top 20 occurring English words (with the first few labeled). The pink line is the theoretical Zipf distribution, which is found to be `f/n^0.94`, where f is the frequency of the top-ranked word and n is the rank of the word.
`f/(1^0.94) = 69970`,
`f/2^0.94 = 69970/2^0.94 = 36470, `
`f/3^0.94 = 69970/3^0.94 = 24912,`
`f/4^0.94 = 69970/4^0.94 = 19009,`
`f/5^0.94 = 69970/5^0.94 = 15412, `
The power `0.94` comes from observing the best line of fit for the word frequencies. (I just did trial and error in Excel until I found the closes fit.)
There is a fairly large gap in the pattern for the words "to", "a" and "in", but it settles down and is quite consistent after that.
We now plot the top 2000 English words and use a log-log scale (log of the rank for the horizontal axis and log of the frequency for the vertical axis). If a distribution gives us a straight line on a log-log scale, then we can say that it is a Zipf Distribution.
We see that there is a remarkably consistent result for the top 2000 most-used English words. For your information, the last few in the list of 2000 words are:
b. Websites and the Zipf Distribution
We also observe a Zipf Distribution when it comes to popularity of pages in Websites.
For example, out of the most recent 500,000 page views in Interactive Mathematics, the most commonly visited page is the homepage, with 27,855 views. The next most common page is the Algebra Introduction, with around 1/2 of the views. The 3rd ranked page has about 1/3 of the views of the most popular page.
|2||Basic Algebra Introduction||`15334`|
|3||Addition & Subtraction in Algebra||`7605`|
|4||Math Of Beauty||`5965`|
|5||Graphs of Sine and Cosine||`5749`|
|6||Volume of Solid of Revolution||`5667`|
|7||Trigonometric Graphs Introduction||`5584`|
|9||Introduction to Trigonometric Functions||`4701`|
For the top 500 pages in the site, we have the following log-log graph of the page views:
The theoretical Zipf Distribution (the pink line) is obtained as follows. The power used, 0.67, once again comes from observing the best line of fit.
`27855/2^0.67 = 17507`
`27855/3^0.67 = 13342`
`27855/4^0.67 = 11003`
`27855/5^0.67 = 9475`
`27855/6^0.67 = 8835 `
After the page ranked 200th, the pattern breaks down, but interestingly, from the 300th to the 500th page, there is still a consistent relationship between rank and frequency.
See also Zipf Distributions, log-log graphs and Site Statistics over in the IntMath blog.