Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## [Matplotlib-users] four colour theorem

 [Matplotlib-users] four colour theorem From: Eric Emsellem - 2012-01-27 09:27:16 ```Dear all, I have a set of Voronoi bins, defined by nodes (x,y) and an underlying mesh of squared bins. See an example here of such Voronoi bins. http://www.google.fr/imgres?q=voronoi+binning&hl=fr&sa=X&biw=1280&bih=665&tbm=isch&prmd=imvnsb&tbnid=zp0RRIktKlF9pM:&imgrefurl=http://www.aanda.org/articles/aa/full/2007/09/aa4621-05/aa4621-05.right.html&docid=CeAk6FN_pZDa5M&imgurl=http://www.aanda.org/articles/aa/full/2007/09/aa4621-05/img26.gif&w=532&h=1087&ei=ZmYiT-Z7xYDyA9ew0acM&zoom=1&iact=rc&dur=164&sig=112304340793152029504&page=4&tbnh=151&tbnw=74&start=63&ndsp=25&ved=1t:429,r:1,s:63&tx=58&ty=65 So basically each node, (x,y) would define a Voronoi bin made of a set of squared pixels. So one node would correspond to for example N squared pixels: node[i] = [(x1,y1),(x2,y2),...(xN,yN)] I want now to create an imshow like plot of these bins by using the four colour theorem, meaning that I would use 4 colours and want adjacent Voronoi bins not to have the same colour. Is there a simple way to do this in matplotlib? I couldn't find much on the web so far. thanks! Eric ```

 [Matplotlib-users] four colour theorem From: Eric Emsellem - 2012-01-27 09:27:16 ```Dear all, I have a set of Voronoi bins, defined by nodes (x,y) and an underlying mesh of squared bins. See an example here of such Voronoi bins. http://www.google.fr/imgres?q=voronoi+binning&hl=fr&sa=X&biw=1280&bih=665&tbm=isch&prmd=imvnsb&tbnid=zp0RRIktKlF9pM:&imgrefurl=http://www.aanda.org/articles/aa/full/2007/09/aa4621-05/aa4621-05.right.html&docid=CeAk6FN_pZDa5M&imgurl=http://www.aanda.org/articles/aa/full/2007/09/aa4621-05/img26.gif&w=532&h=1087&ei=ZmYiT-Z7xYDyA9ew0acM&zoom=1&iact=rc&dur=164&sig=112304340793152029504&page=4&tbnh=151&tbnw=74&start=63&ndsp=25&ved=1t:429,r:1,s:63&tx=58&ty=65 So basically each node, (x,y) would define a Voronoi bin made of a set of squared pixels. So one node would correspond to for example N squared pixels: node[i] = [(x1,y1),(x2,y2),...(xN,yN)] I want now to create an imshow like plot of these bins by using the four colour theorem, meaning that I would use 4 colours and want adjacent Voronoi bins not to have the same colour. Is there a simple way to do this in matplotlib? I couldn't find much on the web so far. thanks! Eric ```
 Re: [Matplotlib-users] four colour theorem From: Benjamin Root - 2012-01-27 15:00:14 Attachments: Message as HTML ```On Friday, January 27, 2012, Eric Emsellem wrote: > Dear all, > > I have a set of Voronoi bins, defined by nodes (x,y) and an underlying > mesh of squared bins. > See an example here of such Voronoi bins. > > http://www.google.fr/imgres?q=voronoi+binning&hl=fr&sa=X&biw=1280&bih=665&tbm=isch&prmd=imvnsb&tbnid=zp0RRIktKlF9pM:&imgrefurl=http://www.aanda.org/articles/aa/full/2007/09/aa4621-05/aa4621-05.right.html&docid=CeAk6FN_pZDa5M&imgurl=http://www.aanda.org/articles/aa/full/2007/09/aa4621-05/img26.gif&w=532&h=1087&ei=ZmYiT-Z7xYDyA9ew0acM&zoom=1&iact=rc&dur=164&sig=112304340793152029504&page=4&tbnh=151&tbnw=74&start=63&ndsp=25&ved=1t:429,r:1,s:63&tx=58&ty=65 > > So basically each node, (x,y) would define a Voronoi bin made of a set > of squared pixels. So one node would correspond to for example N squared > pixels: > > node[i] = [(x1,y1),(x2,y2),...(xN,yN)] > > I want now to create an imshow like plot of these bins by using the four > colour theorem, meaning that I would use 4 colours and want adjacent > Voronoi bins not to have the same colour. > > Is there a simple way to do this in matplotlib? I couldn't find much on > the web so far. > > thanks! > Eric > None that I am aware of, but if one existed, it would likely be found within the basemap module. If it isn't in the Basemap module, it would be an awesome feature to add. Maybe something that would work with my style-cycling mechanism that I have been tinkering with to allow for users to specify 4 different hatchings for b&w publications? Cheers! Ben Root ```