Search code examples
plotstatisticsjuliagadfly

How to change the Colors in rectbin plot in Gadfly?


I am using Gadfly to plot a rectbin in Julia

ticks = [2006,2007,2008,2009,2010,2011,2012,2013,2014,2015]
plot(y=c[1:100],x=y[1:100], Guide.ylabel("Countries"), 
Guide.xlabel("Year"),Guide.title("GDP of Asian Countries from 2006-
2015"),Geom.rectbin,color=g,Guide.xticks(ticks=ticks))

How do I change the default colors?

Here's the graph that is being plotted:

enter image description here


Solution

  • Good news and bad news:

    Good news is you can use Scale.continuous_color_scale_partial(f) as an extra argument to plot(), where f(v) receives a value between 0 and 1 and returns a color

    Bad news is another function like this is nowhere to be found but the default one as of this writing.

    You'll have to do your own. Maybe you can start with a basic example or try to aproximate values based off matplotlib's colormaps.