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

scale_x_continuous

scale_x_continuous scale a continuous x-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_x_continuous("Carat (1 = 200mg)")


Out[2]:
<ggplot: (284507073)>

In [3]:
ggplot(diamonds, aes(x='carat', y='price')) + \
    geom_point() + \
    scale_x_continuous("Carat (1 = 200mg)", breaks=[0, 3, 6])


Out[3]:
<ggplot: (284507089)>

In [4]:
ggplot(diamonds, aes(x='carat', y='price')) + \
    geom_point() + \
    scale_x_continuous("Carat (1 = 200mg)", breaks=[0, 3, 6], labels=["Small", "OK", "Impressive"])


Out[4]:
<ggplot: (285415837)>

In [ ]: