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

scale_color_maual

scale_color_manual applies color values to discrete color variables in your ggplots. It has 1 parameter:

  • values - colors you'd like to use
In [2]:
ggplot(mtcars, aes(x='wt', y='mpg', color='factor(cyl)')) + \
    geom_point() + \
    scale_color_manual(values=['blue', 'green', 'purple'])
Out[2]:
<ggplot: (284426449)>
In [3]:
ggplot(mtcars, aes(x='wt', y='mpg', color='factor(cyl)')) + \
    geom_point() + \
    scale_color_manual(values=['MediumSeaGreen', 'MediumSlateBlue', 'MediumAquaMarine'])
Out[3]:
<ggplot: (285244233)>
In [4]:
ggplot(mtcars, aes(x='wt', y='mpg', color='factor(cyl)')) + \
    geom_point() + \
    scale_color_manual(values=['#ff0000', '#ff8000', '#ffbf00'])
Out[4]:
<ggplot: (285310097)>
In [ ]: