Query about overlaying image plots with transparency

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Query about overlaying image plots with transparency

Lee Taylor
I am trying to superimpose two images.  One is a greyscale and the other
is just an array laid out in a grid with values of 0, 1 or 2.  I'd like
to plot 0 as transparent so the image below is visible then plot 1 and 2
as red.  I can plot the image and I can plot the the grid, but when I
try to plot both it is not working.  The entire plot is red instead of
just the grid. I can get two images to plot if one is an RGBA array, but
not when it is an image (from lena)

Attached is an example derived from chaco/examples/demo/image_plot.py

In addition, is this the best way to set up a small color map?

     colors = array([
     rng = DataRange1D(ArrayDataSource(array([0,2])))
     colormap = ColorMapper.from_palette_array(colors, range=rng, steps=3)

There was a similar question on the chaco-users list last year, but
there was no solution.

I found another question 'Stacking images and controlling their
transparency in a Traits environment' at
but that controlled the alpha of the entire image, not just one color.

I also seem to recall a Chaco demo which plotted an image of a metro
station then did some edge detection and was overlaying the plots, but I
was unable to find any references to it today.

Lee Taylor

Enthought-Dev mailing list
[hidden email]

grey.py (4K) Download Attachment