setting color and alpha channel of histograms

Hi, Is there a way to set the color of an histogram? what

    > about transparency ?

    > for example:

    > h=hist(x... set(h,'alpha',0.75)

Of course, not all backends support the alpha channel (eg postscript),
but this is already possible with the agg backend

Here is some example code

    n, binsb, pb = hist(sb, 100,normed=True)
    set(pb, 'facecolor', 'r', 'alpha', 1.0)

Perhaps the problem with your test code above is that histogram
returns a tuple of (counts, bins, patches) and you need to set the
alpha on the patches only.

    > I would like to superimpose histograms on the same plot
    > but they would have to be of different colors and be
    > translucent.

    > I need to do this in using the matlab interface, not the
    > API.

Yep, I've done exactly this before using the code above; here's an
example image where one histogram is translucent gray superimposed
over a red histogram

http://nitace.bsd.uchicago.edu:8080/files/share/aptopower.png

JDH

Thanks John!!

Maybe it would be a good idea to update the histogram example to include these features since the documentation for hist does not mention anything about it.

*

Hi, Is there a way to set the color of an histogram? what
about transparency ?
for example:
h=hist(x… set(h,‘alpha’,0.75)
Of course, not all backends support the alpha channel (eg postscript),
but this is already possible with the agg backend
Here is some example code
n, binsb, pb = hist(sb, 100,normed=True)
set(pb, ‘facecolor’, ‘r’, ‘alpha’, 1.0)
Perhaps the problem with your test code above is that histogram
returns a tuple of (counts, bins, patches) and you need to set the
alpha on the patches only.
I would like to superimpose histograms on the same plot
but they would have to be of different colors and be
translucent.
I need to do this in using the matlab interface, not the
API.
Yep, I’ve done exactly this before using the code above; here’s an
example image where one histogram is translucent gray superimposed
over a red histogram*
http://nitace.bsd.uchicago.edu:8080/files/share/aptopower.png

JDH


fiocruz4.jpg
Flávio Codeço Coelho, PhD

Programa de Computação Científica

Fundação Oswaldo Cruz

Rio de Janeiro – Brasil

···

On Wed, 2004-06-02 at 13:41, John Hunter wrote: