Heatmap in matplotlib with pcolor?

This is late, but here is my python implementation of the flowingdata NBA heatmap. updated:1/4/2014: thanks everyone # -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # ———————————————————————— # Filename : heatmap.py # Date : 2013-04-19 # Updated : 2014-01-04 # Author : @LotzJoe >> Joe Lotz # Description: My attempt at reproducing the FlowingData graphic in … Read more

Construct a manual legend for a complicated plot

You need to map attributes to aesthetics (colours within the aes statement) to produce a legend. cols <- c(“LINE1″=”#f04546″,”LINE2″=”#3591d1″,”BAR”=”#62c76b”) ggplot(data=data,aes(x=a)) + geom_bar(stat=”identity”, aes(y=h, fill = “BAR”),colour=”#333333″)+ #green geom_line(aes(y=b,group=1, colour=”LINE1″),size=1.0) + #red geom_point(aes(y=b, colour=”LINE1″),size=3) + #red geom_errorbar(aes(ymin=d, ymax=e, colour=”LINE1″), width=0.1, size=.8) + geom_line(aes(y=c,group=1,colour=”LINE2″),size=1.0) + #blue geom_point(aes(y=c,colour=”LINE2″),size=3) + #blue geom_errorbar(aes(ymin=f, ymax=g,colour=”LINE2″), width=0.1, size=.8) + scale_colour_manual(name=”Error Bars”,values=cols) + … Read more