Hello.

I have had an issue trying to plot an histogram with Matplotlib. The line is:

plt.hist([SNIa.angles, SNIbc.angles, SNII.angles], 11, range=[-pi, pi],
         normed=True,histtype='stepfilled',color=['g', 'r',
'b'],alpha=[1, 0.6, 1])

But the error is raised when I try to save the image. For completness,
the  whole program is here:
http://nopaste.voric.com/paste.php?f=8zl9i4

If I call hist as stated above, I get the following error report:

Traceback (most recent call last):
  File "C:\Documents and
Settings\David\Escritorio\Python\IAYC\Supernovae\final\Deprecated\supernovae_bug.py",
line 35, in <module>
    plt.savefig('angular_merged_1bis.png')
  File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 363,
in savefig
    return fig.savefig(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line
1084, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py",
line 1886, in print_figure
    **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 438, in print_png
    FigureCanvasAgg.draw(self)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 394, in draw
    self.figure.draw(self.renderer)
  File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 55,
in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 798, in draw
    func(*args)
  File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 55,
in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1934, in draw
    a.draw(renderer)
  File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 55,
in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\patches.py", line 366, in draw
    r, g, b, a = colors.colorConverter.to_rgba(self._facecolor, self._alpha)
  File "C:\Python25\Lib\site-packages\matplotlib\colors.py", line 353,
in to_rgba
    raise ValueError('to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgba: Invalid rgba arg "[ 0.   0.5  0.   1. ]"
alpha must be in range 0-1



If I delete the color declaring, I get instead:

Traceback (most recent call last):
  File "C:\Documents and
Settings\David\Escritorio\Python\IAYC\Supernovae\final\Deprecated\supernovae_bug.py",
line 35, in <module>
    plt.savefig('angular_merged_1bis.png')
  File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 363,
in savefig
    return fig.savefig(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line
1084, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py",
line 1886, in print_figure
    **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 438, in print_png
    FigureCanvasAgg.draw(self)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 394, in draw
    self.figure.draw(self.renderer)
  File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 55,
in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 798, in draw
    func(*args)
  File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 55,
in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1934, in draw
    a.draw(renderer)
  File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 55,
in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\patches.py", line 383, in draw
    renderer.draw_path(gc, tpath, affine, rgbFace)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 117, in draw_path
    self._renderer.draw_path(gc, path, transform, rgbFace)
TypeError: float() argument must be a string or a number

And works fine without alpha statement. Any change in the other
arguments does not make any difference on the behaviour.

If I run it from the IDLE, once I get an error, I continue getting it
even if the problematic part is fixed, until I restart the program. I
am running Matplotlib 1.0.0 y Python 2.5 sobre WXP.

I haven't find any reference to this in the documentation, so it seems
to be a bug.



Regards,

David.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to