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.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to