setting color and alpha channel of histograms

*

Yes, I read it, but I meant a reference to transparency
and different colors which in the plot help is explicitly
mentioned (color, not transparency).
The point is that you can set any property on any object returned. So
if the documentation says that a list of patches is returned, you
should know that you can call any of the patch methods on those
patches, which are listed at*
http://matplotlib.sf.net/matplotlib.patches.html and
http://matplotlib.sf.net/matplotlib.artist.html (the base class for
patches).
I’ll beef up the documentation, on your suggestions.
While on the subject, I had a problem with the legend to
such a plot.
m,b,p1 = hist(q2phi,bins=50,normed=1) n, bins, pb =
hist(postR0,bins=50,normed=1)
set(pb,‘facecolor’,‘r’,‘alpha’,0.5) l =
plot(arange(ll,ul,(ul-ll)/512.),lik[0],‘g-o’)
legend((p1,pb,l),(‘Prior’,‘Posterior’,‘Likelihood’))
the legend that comes out of of it puts a blue square (the
color of the first hist) for all three items.
You probably want
legend((p1[0],pb[0],l[0]),(‘Prior’,‘Posterior’,‘Likelihood’))
p1, pb and l are a list of patches or lines. You want to label the
three things in your legend with one element of each sequence. Hence
the [0] subscript. The tuple
(p1[0],pb[0],l[0]) means
(the first p1 patch, the first pb patch, the first line)
Clear?

Crystal! But then the legends second example(legend_demo2) is a bit misleading since it uses the syntax I used originally (without the subscripts). I am aware of the difference between the two situations, but my general point is that since the examples are one of the main sources of instruction for users, they should be as complete as possible, i.e. contain as many variations on the theme as possible, don’t you agree?

Of course they should not substitute the prime directive: RTFM!, but they are a powerful tool that should be explored.

thanks again,

Flavio

*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 16:33, John Hunter wrote: