SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Carlos G. <car...@gm...> - 2010年04月30日 17:30:08
Hi all,
I'm wirking on a wxpython app, and I realized that the legend of a
matplotlib plot only works with solid lines. If I change the
linestyles to dashed, dotted or dashdot, it gives an error:
Traceback (most recent call last):
 File "/home/guano/Arbeit/Stout/StereoPanel.py", line 551, in PlotChecked
 self.stereoCanvas.draw()
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_wxagg.py",
line 59, in draw
 FigureCanvasAgg.draw(self)
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
line 314, in draw
 self.figure.draw(self.renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
in draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 774, in draw
 for a in self.axes: a.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
in draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1721, in draw
 a.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
in draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/legend.py", line 386, in draw
 self._legend_box.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 488, in draw
 c.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
in draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 535, in draw
 drawFunc(renderer, gc, tpath, affine.frozen())
 File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 874,
in _draw_lines
 self._lineFunc(renderer, gc, path, trans)
 File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 925,
in _draw_dashed
 renderer.draw_path(gc, path, trans)
 File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
line 98, in draw_path
 self._renderer.draw_path(gc, path, transform, rgbFace)
TypeError: float() argument must be a string or a number
This happens for Line2D and for LineCollection as well.
TIA
Carlos
-- 
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
Linux User #89721
________________
Can’t stop the signal.
From: Michael D. <md...@st...> - 2010年04月30日 17:35:37
The following works for me.
 from pylab import *
 plot([1,2,3], linestyle='dashed', label='foo')
 legend()
 show()
Can you be more specific about how you create the error?
Mike
Carlos Grohmann wrote:
> Hi all,
>
> I'm wirking on a wxpython app, and I realized that the legend of a
> matplotlib plot only works with solid lines. If I change the
> linestyles to dashed, dotted or dashdot, it gives an error:
>
> Traceback (most recent call last):
> File "/home/guano/Arbeit/Stout/StereoPanel.py", line 551, in PlotChecked
> self.stereoCanvas.draw()
> File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_wxagg.py",
> line 59, in draw
> FigureCanvasAgg.draw(self)
> File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
> line 314, in draw
> self.figure.draw(self.renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
> in draw_wrapper
> draw(artist, renderer, *kl)
> File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 774, in draw
> for a in self.axes: a.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
> in draw_wrapper
> draw(artist, renderer, *kl)
> File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1721, in draw
> a.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
> in draw_wrapper
> draw(artist, renderer, *kl)
> File "/usr/lib/pymodules/python2.6/matplotlib/legend.py", line 386, in draw
> self._legend_box.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 224, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/offsetbox.py", line 488, in draw
> c.draw(renderer)
> File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
> in draw_wrapper
> draw(artist, renderer, *kl)
> File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 535, in draw
> drawFunc(renderer, gc, tpath, affine.frozen())
> File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 874,
> in _draw_lines
> self._lineFunc(renderer, gc, path, trans)
> File "/usr/lib/pymodules/python2.6/matplotlib/lines.py", line 925,
> in _draw_dashed
> renderer.draw_path(gc, path, trans)
> File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
> line 98, in draw_path
> self._renderer.draw_path(gc, path, transform, rgbFace)
> TypeError: float() argument must be a string or a number
>
>
>
> This happens for Line2D and for LineCollection as well.
>
> TIA
>
> Carlos
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /