For everyone who is interested, I was able to fix it myself. The coordinates (x, y) of each segment (for Alaska and Hawaii) must be translated. I also reduce Alaska to 35% before translating it.
The second for loop should be modified as follows:
for nshape,seg in enumerate(m.states): # skip DC and Puerto Rico. if statenames[nshape] not in ['Puerto Rico', 'District of Columbia']: # Offset Alaska and Hawaii to the lower-left corner. if statenames[nshape] == 'Alaska': # Alaska is too big. Scale it down to 35% first, then transate it. seg = list(map(lambda (x,y): (0.35*x + 1100000, 0.35*y-1300000), seg)) if statenames[nshape] == 'Hawaii': seg = list(map(lambda (x,y): (x + 5100000, y-900000), seg)) color = rgb2hex(colors[statenames[nshape]]) poly = Polygon(seg,facecolor=color,edgecolor=color) ax.add_patch(poly)
Here is the new US map (using the Greens color map).

source share