Four Famous Laws & How You Can Visualize Them

January 22, 2015

(This article was first published on Plotly, and kindly contributed to R-bloggers)

Famous laws, theorems, and observations are often named after the person who proposed the idea. These “eponymous laws” can be graphed. We do so in this post, using our free, web-based product. Contact us about getting a trial of Plotly Enterprise on your servers.

Moore’s Law

Transistors are used in building electronics. The number of transistors in a circuit has been doubling approximately every two years, an observation made by Intel co-founder Gordon E. Moore. This creates exponential improvements in the performance of electronics every two years. Moore’s Law is graphed below.

Zipf’s Law

Zipf’s law states that in a corpus (a group of words, as in a book or set of articles) the frequency of a word is inversely proportional to its rank. The graph below shows a Zipfian distribution from a group of 29 works of British literature. The word “the” occurred most frequently: 225,300 times. “Is” was second most popular.

Zipfian distributions create a line when we plot frequency (y-axis) and word usage rank (x-axis) on a double log-axis plot. On the right we show the same data on a linear scale. The inset histogram shows how often each word was used. Zoom in to see another 998 words.

Benford’s Law

Many real-life sources of data follow Benford’s Law: 1 occurs as the leading digit in numbers about 30% of the time. Others are less common, with 9 as the first digit less than 5% of the time. A pair of mathematicians who studied the law concluded that “Benford’s law continues to defy attempts at an easy derivation.” Shown below are a few examples, with the equation describing the law as the title. The random number generator used here produced uniform random numbers. We could design a random number generator that would follow Benford’s Law.

We can show the data in one graph, then filter in the legend. If you’re an R user, you can make a Benford’s Law graph with ggplot2 and Plotly. A note: we’re hiring R developers. Email jobs [at] plot [dot] ly.

Hubble’s Law

When a train or fire truck approaches you, the pitch sounds lower; the pitch shifts upward if the source is going away from you. That is a simple example of the Doppler effect, first demonstrated in 1845. A train pulled an open car full of trumpet players playing the same note. Observers heard the drop in tone when the car passed.

An observable Doppler shift also occurs when a light source is moving away from you. The light pattern shifts towards the red end of the spectrum. If the source is moving towards you pattern shifts towards the blue end of the spectrum. Hubble’s law applies this knowledge, using velocity to estimate the distance of galaxies from Earth. The plot below is based on data gathered by James Imamura and shows the estimated distance of over 1,000 galaxies. Mpc stands for megaparsec, a unit astronomers use to indicate distances between galaxies.

What Is Plotly?

Plotly supports collaborative graphing for anyone using the web or Excel, Google Docs, Python, matplotlib, R, ggplot2, & MATLAB. Collaborate online with anyone on any browser or device without any downloads or installations. We support 2D, 3D, and streaming graphs and have over 100K users from science, engineering, industry, journalism, academia, and education (K-12 & up). Plotly is free for unlimited sharing, or you can run Plotly on-premise on a private server; contact us today to start a trial.

To leave a comment for the author, please follow the link and comment on their blog: Plotly. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)