Alexandr1157 / scitools

Automatically exported from code.google.com/p/scitools
Other
0 stars 0 forks source link

plot does not work #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.import numpy as np
import matplotlib.pyplot as plt
from numpy import *
from scitools.std import *
from matplotlib.pylab import *

def f(t):
    return t**2*exp(-t**2)

t = linspace(0,3,31)
y = f(t)

plot(t, y)
show()

2.
3.

What is the expected output? What do you see instead?
Expect to see a plot of t^2 exp(-t^2) instead get a blank screen.
What version of the product are you using? On what operating system?
sctools version 0.9.0 running on Ubuntu LTS 12.04 64bit

Please provide any additional information below.
removing scitools.std import and running the script works fine.

Original issue reported on code.google.com by arefnamm...@gmail.com on 19 Nov 2013 at 12:36

GoogleCodeExporter commented 8 years ago
Just tried removing all imports except for scitools.std and this time the 
script ran OK but the plot disappears very quickly.

Original comment by arefnamm...@gmail.com on 19 Nov 2013 at 12:52

GoogleCodeExporter commented 8 years ago
further testing indicated that importing matplotlib.pylab causes the behavior 
first noted i.e. no plot being displayed.

Original comment by arefnamm...@gmail.com on 19 Nov 2013 at 12:59

GoogleCodeExporter commented 8 years ago
I cannot reproduce this. Can you try to leave out most of the import statments 
and only import scitools? Like in the following script:

from scitools.std import *

def f(t):
    return t**2*exp(-t**2)

t = linspace(0,3,31)
y = f(t)

plot(t, y)
show()

# This will keep the plot from disappearing
raw_input('press enter')

Original comment by johannes...@gmail.com on 19 Nov 2013 at 1:02

GoogleCodeExporter commented 8 years ago
When you do

  from matplotlib.pylab import *

after

  from scitools.std import *

you will end up with the plot command from matplotlib, not the one from 
scitools.

Original comment by johannes...@gmail.com on 19 Nov 2013 at 1:04

GoogleCodeExporter commented 8 years ago
Thanks johannes. Yes keeping only scitools.std import * works but the plot does 
not stay even with show(). The raw_input() does not work in the script--I get 
EOF error, however, it works in the IDE. 
If I remove the scitools.std import * statement and keep matplotlib the plot 
stays with show() as expected.
Thanks for taking the time to respond.

Original comment by arefnamm...@gmail.com on 19 Nov 2013 at 1:54

GoogleCodeExporter commented 8 years ago
OK this is getting interesting. Running the code with show() from the command 
line or using IDLE works fine. Using other editors such as Ninja or SciTE the 
show() does not seem to work and raw_input() does not work--returns EOF error. 
I suppose there is a compatibility issue with some editors. 

Original comment by arefnamm...@gmail.com on 19 Nov 2013 at 4:24

GoogleCodeExporter commented 8 years ago
The show() command in scitools is not the same as the show() command in 
matplotlib. It doesn't make the plot stay as in matplotlib, it just redraws the 
current figure. You can use raw_input() or time.sleep() to make the plot stay. 
If raw_input() doesn't work with your editor, then that is an issue with the 
editor.

If you would like to use the matplotlib backend, then see "Controlling the 
Backend" in the Easyviz documentation:

https://code.google.com/p/scitools/wiki/EasyvizDocumentation

I don't see that this is an issue with scitools, so I will mark this as invalid.

Original comment by johannes...@gmail.com on 20 Nov 2013 at 10:42