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

scale_y_continuous

scale_y_continuous scale a continuous y-axis. Its parameters are:

  • name - axis label
  • breaks - x tick breaks
  • labels - x tick labels
In [2]:
ggplot(diamonds, aes(x='carat', y='price')) + \
    geom_point() + \
    scale_y_continuous("Price ($)")
Out[2]:
<ggplot: (284428481)>
In [3]:
ggplot(diamonds, aes(x='carat', y='price')) + \
    geom_point() + \
    scale_y_continuous("Price ($)", breaks=[0, 7500, 15000, 25000])
Out[3]:
<ggplot: (284428525)>
In [4]:
ggplot(diamonds, aes(x='carat', y='price')) + \
    geom_point() + \
    scale_y_continuous("Price ($)", breaks=[0, 7500, 15000, 25000], labels=["Cheap", "Not So Cheap", "Costly", "Dumb"])
Out[4]:
<ggplot: (285016369)>
In [ ]: