Hi, I like this, too.
However, I don't understand why it works at all. Usually, when I apply
a colormap, I need to take care about the scaling myself, i.e. divide
the range up into the number of elements to plot:
import pylab as pl
import matplotlib.cm as cm
xval = pl.arange(0, 20, 0.2)
n = 256
for i in range(n):
# pl.plot(xval, pl.sin(xval)+i, c=cm.hot(i), lw=5)
pl.plot(xval, pl.sin(xval)+i, c=cm.hot(1.*i/n), lw=5)
Can anyone tell me why this is not necessary here but essential for
example here:
for i,infile in enumerate(infiles):
## title for plot
tname = os.path.splitext(infile)[0]
## read data
f = FileHelpers.BlockedFile(infile)
alldata = scipy.array([[],[]])
for ii in ['+', '2', 'x', '1']: # use for markers, too
# for ii in [4,3,2,1]: # use for markers, too
try:
f.next_block()
data = scipy.loadtxt(f).T
alldata = scipy.concatenate((alldata, data), axis=1)
# ax.plot(data[0],data[1], '%s'%ii,
color=cm.hot(1.*i/len(infiles)), mew=1.5 )
ax.plot(data[0],data[1], '%s'%ii, c=cm.hot(i), mew=1.5 )
except Exception, e:
print e
break
Thanks in advance,
Daniel
>> I have found a simple and better way. One can chose from colors from a
>> color
>> map:
>>
>> >>import pylab as pl
>> >>import matplotlib.cm as cm
>> >>xval = pl.arange(0, 20, 0.2)
>> >>for i in range(256):
>> ... pl.plot(xval, pl.sin(xval)+i, c=cm.hot(i), lw=5)
>>
>> This one if, for instance, picking from a color map called "hot". If one
>> wants to the colors to fade away, or darken, the "alpha" option can be
>> utilized or another color map in which colors darken or fade into another
>> color.
>>
>> There is no need for a long sophisticated script.
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users