|
From: Nicolas B. <nbi...@gm...> - 2010-11-09 03:21:01
|
>
> How can I automatically cycle through distinctive line markers?
>>
>> I want a semilog plot, composed of a number of lines. Each line should
>> have
>> a different color and marker.
>
>
I simply use:
colors = ['b', 'r', 'c', 'm', 'k', 'g', 'y']
symbols = ['-', '--', '-.', ':']
nc = len(colors)
ns = len(symbols)
cs = 0
cc = 0
for i in numpy.arange(len(parameters_list)):
plt.plot(x, y, colors[cc%nc] + symbols[cs%ns], label=r'$\Delta x_{min} =
' + str(dxmin[j]) + ', N = ' + str(Ns[i]) + r'$')
cc += 1
if (cc == nc):
cc = 0
cs += 1
This will cycle through symbols when colors run out. You can indent or not
"cs" to cycle through symbols too.
|