Ryugan Mizuta wrote:
> Hi all,
>
> I'm trying to create multiple lines on one graph. Anybody have an
> idea of plotiing multiple lines without writing the plot statement a
> number of times? Is it possible to include the plot statement inside
> a "for" statement to produce multiple lines in one graph???
>
>
Hi Ryugan,
There are a lot of ways to do this, I dont know them all. Here are a few
to get you started:
from matplotlib.matlab import *
a=arange(10)
b=a*2
c=a*3
figure(1)
plot(a,b,a,c)
figure(2)
plot(a,b,'k',a,c,'r')
figure(3)
[plot(a,i) for i in [b,c]]
#equivalent to:
figure(4)
for i in [b,c]:
plot(a,i)
|