##// END OF EJS Templates
Walter's ipipe patch:...
Walter's ipipe patch: If calling a function in _getattr() raises an AttributeError, return the default. Make xattrs() more robust: If calling __xattrs__() raises an exception fall back to (None,). Make xrepr() more robust: If calling __repr__() raises an exception fall back to using repr(). Replace a generator expression with a list comprehension in the _BrowserLevel constructor so that ipipe stays Python 2.3 compatible. Fix handling of empty lists in ibrowse: You can not enter empty lists, and the browser displays an empty screen with the message <empty>.

File last commit:

r0:6f629fcc
r231:5f76942f
Show More
example-gnuplot.py
36 lines | 1017 B | text/x-python | PythonLexer
/ doc / examples / example-gnuplot.py
fperez
Reorganized the directory for ipython/ to have its own dir, which is a bit...
r0 #!/usr/bin/env python
"""
Example code showing how to use Gnuplot and an embedded IPython shell.
"""
from Numeric import *
from IPython.numutils import *
from IPython.Shell import IPShellEmbed
# Arguments to start IPython shell with. Load numeric profile.
ipargs = ['-profile','numeric']
ipshell = IPShellEmbed(ipargs)
# Compute sin(x) over the 0..2pi range at 200 points
x = frange(0,2*pi,npts=200)
y = sin(x)
# In the 'numeric' profile, IPython has an internal gnuplot instance:
g = ipshell.IP.gnuplot
# Change some defaults
g('set style data lines')
# Or also call a multi-line set of gnuplot commands on it:
g("""
set xrange [0:pi] # Set the visible range to half the data only
set title 'Half sine' # Global gnuplot labels
set xlabel 'theta'
set ylabel 'sin(theta)'
""")
# Now start an embedded ipython.
ipshell('Starting the embedded IPyhton.\n'
'Try calling plot(x,y), or @gpc for direct access to Gnuplot"\n')
#********************** End of file <example-gnuplot.py> *********************