Python 3.5.1 |Anaconda 2.5.0 (64-bit)

The attached script works well and plots when used in the Spyder console
But when used with Spyder IPython 4.0.3 the plot hangs.

When I try to run the script directly in IPython, I get the figure and 
labels, but without any graph

What am I doing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.
# -*- coding: utf-8 -*-
"""
Created on Tue May 17 01:14:17 2016

@author: cseligman
"""
#%%
import os
os.getcwd()
#os.mkdir('C:\\Users\\cseligman\\Dropbox\\Documents\\Pythonworkspace\\ODEs')
os.chdir('C:\\Users\\cseligman\\Dropbox\\Documents\\Pythonworkspace\\ODEs')


import math
import matplotlib
import matplotlib.pyplot as plt

# Initial conditions
y0 = 2.0
#Time step and final time
dt = 1.0 # days
tf = 364.0 # days
# Empty lists to hold time and solutions
tt = []
yy= []
# append initial values
tt.append(0.0)
yy.append(y0)

#parameters of our equation
a = 0.01
omega = 2.0*math.pi/365.0

# Iteration
while tt[-1] <= tf:
    r = a * yy[-1] * (1 + math.sin(omega*tt[-1]))
    yy.append(yy[-1]+ r * dt)
    tt.append(tt[-1] + dt)
#%%    
plt.figure(1)
plt.plot(tt,yy,'.')
plt.xlabel('Time_[days]')
plt.ylabel('Rats_[rats]')
plt.title('Euler_Solution')
plt.show()
#%%
    

Reply via email to