In [1]:
%matplotlib inline
from ggplot import *
import pandas as pd

scale_y_log

scale_y_log applies a logarithmic scale to your y-axis. Its parameters are:

  • base - base value logarithm. defaults to 10
In [2]:
ggplot(diamonds, aes(x='carat', y='price')) + \
    geom_point() + \
    scale_y_log()
Out[2]:
<ggplot: (284426693)>
In [3]:
pageviews['hour'] = pageviews.date_hour.apply(lambda x: x.hour)
ggplot(pageviews, aes(x='hour', weight='pageviews')) + \
    geom_bar()
Out[3]:
<ggplot: (285670021)>
In [4]:
ggplot(pageviews, aes(x='hour', weight='pageviews')) + \
    geom_bar() + \
    scale_y_log()
Out[4]:
<ggplot: (289832569)>
In [ ]: