I converted your example to a standalone one (attached), and it does
work for me. It's hard to say what may be going wrong for you without
knowing what a_steady and L_range are and what the limits of the axes
are getting set to etc. Can you provide a fully self-contained script
that exhibits this behavior? Also, what version of matplotlib and
platform are you using?
Cheers,
Mike
Zoho Vignochi wrote:
On Thu, 01 May 2008 22:00:33 +0000, Zoho Vignochi wrote:
Hello:
I have a script in which I have been using plot to plot numerous lines
on the same graph. I recently wanted to see how Line Collections work so
I tried porting it over. Everything successful except I can't seem to
get each line to be a different color. Here is the relevant section:
# Make a list of colors cycling through the rgbcmyk series.
colors = [colorConverter.to_rgba(c) for c in
('r','g','b','c','y','m','k')]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
lines = collections.LineCollection([zip(L_range, item) for item
in a_steady])
lines.set_array(L_range)
lines.set_color(colors)
ax.add_collection(lines, autolim=True)
However every line is blue. Any ideas?
I should mention my import lines:
import numpy as np
from numpy import sum, zeros, less, where
import scipy as sp
import matplotlib.pyplot as plt
from matplotlib import collections
from matplotlib.colors import colorConverter
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
import numpy as np
from numpy import sum, zeros, less, where
import scipy as sp
import matplotlib.pyplot as plt
from matplotlib import collections
from matplotlib.colors import colorConverter
colors = [colorConverter.to_rgba(c) for c in
('r','g','b','c','y','m','k')]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
lines = collections.LineCollection([[[x,0], [x+1, 1], [x+2, 2]] for x in
range(20)])
# lines.set_array(L_range)
lines.set_color(colors)
ax.add_collection(lines, autolim=True)
ax.set_xlim(0, 21)
ax.set_ylim(0, 2)
plt.show()
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users