SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Mark B. <ma...@gm...> - 2007年10月31日 12:19:32
Hello -
I got confused about specifying colors and linewidths for LineCollections.
I think it would be helpful if the docstrings explicitly state that they
should be sequences.
I know, they do in some way, but it i
Maybe we should even check this on input, as the error message you get when
you don't do that is confusing.
Let me explain:
from pylab import *
from matplotlib.collections import LineCollection
ax = subplot(111)
ax.add_collection( LineCollection( [[(0,0),(1,1)]], colors='r' ) )
draw()
This works fine, as apparantly colors='r' is interpreted as a sequence.
This does not work, however:
ax.add_collection( LineCollection( [[(0,0),(1,1)]], colors='r', linewidths=2
) )
draw()
Now I get an error: TypeError: CXX: type error. That's not too helpful.
What does work is
ax.add_collection( LineCollection( [[(0,0),(1,1)]], colors='r',
linewidths=[2] ) )
draw()
Maybe the confusing part is that just specifying colors='r' works.
Thanks,
Mark
ps. I do all the draws as I am in interactive mode.
From: John H. <jd...@gm...> - 2007年10月31日 13:21:41
On 10/31/07, Mark Bakker <ma...@gm...> wrote:
> This works fine, as apparantly colors='r' is interpreted as a sequence.
> This does not work, however:
>
> ax.add_collection( LineCollection( [[(0,0),(1,1)]], colors='r', linewidths=2
> ) )
> draw()
>
> Now I get an error: TypeError: CXX: type error. That's not too helpful.
This is fixed in svn -- now collection properties should work with a
scalar or iterable so if you find more problems, let us know.
JDH
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 によって変換されたページ (->オリジナル) /