Re: [Matplotlib-users] Using colourmap from matplotlib

2010-03-21 Thread Friedrich Romstedt
2010/3/20 Ciarán Mooney general.moo...@googlemail.com: I am using PIL because I plan to plug in a Tkinter interface which can directly accept PIL image instances. You can render matplotlib figures to PIL using following code: figure.set_size_inches(float(shape[0]) / figure.dpi, float(shape[1])

Re: [Matplotlib-users] Using colourmap from matplotlib

2010-03-20 Thread Ciarán Mooney
Hi, I haven't tried it, but maybe it's to do with the fact that you're quantising the colourmap to 256 values; I think matplotlib computes the exact rgb values using interpolation. If the only reason you're using PIL is to get a .bmp file, maybe you could save the file straight from

Re: [Matplotlib-users] Using colourmap from matplotlib

2010-03-19 Thread Gary Ruben
I haven't tried it, but maybe it's to do with the fact that you're quantising the colourmap to 256 values; I think matplotlib computes the exact rgb values using interpolation. If the only reason you're using PIL is to get a .bmp file, maybe you could save the file straight from matplotlib as

[Matplotlib-users] Using colourmap from matplotlib

2010-03-18 Thread Ciarán Mooney
Hi, I am trying to create an image from an array using PIL, numpy and a colourmap from matplotlib. I got the colourmap by using ipython and the following code colourmap = [] for i in xrange(256): r,g,b,a = cm.jet(i) r = int(round((r * 255),0)) g = int(round((g * 255),0)) b =

Re: [Matplotlib-users] Using colourmap from matplotlib

2010-03-18 Thread Friedrich Romstedt
2010/3/18 Ciarán Mooney general.moo...@googlemail.com: value = (log(x)/log(largest))*255 Just two thoughts: 1) I doubt the statement cited above is not correct, as it may also yield negative values as soon as 0 x 1. In fact, you are calculating log_{largest}(x). This