Usage of logarithm in Scatter graphs

The scatter charts above indicate the Life Expectancy figures Vs Per Capita GDP in some countries.  If you notice the graph to the left looks cleaner than the one to the right.  The reason for this is that in the x-axis – the data is taken on a logarithmic scale. Also if you look at the ticks on the x-axis – the one on the left looks neater than the one on the right.

The way this is achieved is by using the plt.xscale(‘log’) syntax.  Clearly, as you can see, there is really no relationship between GDP and Life expectancy. 

The entire piece of code is given here:

# Basic scatter plot, log scale

plt.scatter(gdp_cap, life_exp)


# Strings

xlab = ‘GDP per Capita [in USD]’

ylab = ‘Life Expectancy [in years]’

title = ‘World Development in 2007’

# Add axis labels



# Add title




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: