[Matplotlib-users] Can't seem to plot 2 horizontal lines on same plot

2008-10-07 Thread chris
I don't know what dumb thing I'm going but I can't seem to plot
2 horizontal lines on the same plot!!!


Why does this snippet give a *BLANK* plot when I run it?

(Either line separately seems to be ok!?!?)

import pylab
x1 = pylab.arange(-10, 10, 0.01)
x2 = pylab.arange(  0, 10, 0.01)
f1 = [0 for e in x1]
f2 = [1 for e in x2]
pylab.show(pylab.plot(x1, f1, x2, f2))


Chris

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Can't seem to plot 2 horizontal lines on same plot

2008-10-07 Thread Johann Rohwer
On Tuesday, 7 October 2008, [EMAIL PROTECTED] wrote:
 Why does this snippet give a *BLANK* plot when I run it?

 (Either line separately seems to be ok!?!?)

 import pylab
 x1 = pylab.arange(-10, 10, 0.01)
 x2 = pylab.arange(  0, 10, 0.01)
 f1 = [0 for e in x1]
 f2 = [1 for e in x2]
 pylab.show(pylab.plot(x1, f1, x2, f2))

The autoscaling feature sets the y limits to [0,1] which means that 
your lines are falling on the bottom and top x-axis which hides them. 
Rescaling the y-axis will make the lines visible, e.g.

pylab.ylim(-1,2)

Johann

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Can't seem to plot 2 horizontal lines on same plot

2008-10-07 Thread Michael Droettboom
pylab.show() takes no arguments.  The pylab interface is stateful, 
meaning you run a series of commands in order and it usually does the 
right thing, rather than passing the results of one function into 
another (in general).

Did you not get an exception when you ran your example?

The following works for me:

import pylab
x1 = pylab.arange(-10, 10, 0.01)
x2 = pylab.arange(  0, 10, 0.01)
f1 = [0 for e in x1]
f2 = [1 for e in x2]
pylab.plot(x1, f1, x2, f2)
pylab.show()



[EMAIL PROTECTED] wrote:
 I don't know what dumb thing I'm going but I can't seem to plot
 2 horizontal lines on the same plot!!!


 Why does this snippet give a *BLANK* plot when I run it?

 (Either line separately seems to be ok!?!?)

 import pylab
 x1 = pylab.arange(-10, 10, 0.01)
 x2 = pylab.arange(  0, 10, 0.01)
 f1 = [0 for e in x1]
 f2 = [1 for e in x2]
 pylab.show(pylab.plot(x1, f1, x2, f2))


 Chris

 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
 Build the coolest Linux based applications with Moblin SDK  win great prizes
 Grand prize is a trip for two to an Open Source event anywhere in the world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 ___
 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


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Can't seem to plot 2 horizontal lines on same plot

2008-10-07 Thread chris
On Tue, Oct 07, 2008 at 12:54:49PM +0200, Johann Rohwer wrote:
 The autoscaling feature sets the y limits to [0,1] which means that
 your lines are falling on the bottom and top x-axis which hides them.
 Rescaling the y-axis will make the lines visible, e.g.

 pylab.ylim(-1,2)

Thank you very much.  That did it.

cs

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Can't seem to plot 2 horizontal lines on same plot

2008-10-07 Thread chris
On Tue, Oct 07, 2008 at 08:19:39AM -0400, Michael Droettboom wrote:
 Did you not get an exception when you ran your example?

 The following works for me:

 import pylab
 x1 = pylab.arange(-10, 10, 0.01)
 x2 = pylab.arange(  0, 10, 0.01)
 f1 = [0 for e in x1]
 f2 = [1 for e in x2]
 pylab.plot(x1, f1, x2, f2)
 pylab.show()

The lines aren't visible when I do it.  No exceptions given.

cs

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users