Using a pre-defined color palette in ggplot

You must put colour = rhg_cols inside aes(). As far as I can tell, you want to apply gradient to bars (in barplot) with factor variable on the abscissa? Then use fill - try this instead:

ggplot(mydata, aes(factor(phone_partner_products), fill = factor(phone_partner_products))) +
  geom_bar() + 
  scale_fill_manual(values = rhg_cols)

or try to achieve approximate replica with:

ggplot(mydata, aes(factor(phone_partner_products), fill = phone_partner_products))) +
  geom_bar() + 
  scale_fill_gradient(low = "#771C19", high = "#000000")

Notice that in second case a continuous variable is passed to fill aesthetics, therefore scale_fill_gradient is passed afterwards. If you pass a factor to the fill aes, you must stick with scale_fill_manual(values = rhg_cols).


If the colours are a palette, use scale_colour_manual:

ggplot(mydata, aes(factor(phone_partner_products), colour = colour_variable)) +
  scale_colour_manual(values = rhg_cols)