##// END OF EJS Templates
Merge branch 'glut-rebased' of git://github.com/fperez/ipython into glut...
Merge branch 'glut-rebased' of git://github.com/fperez/ipython into glut * 'glut-rebased' of git://github.com/fperez/ipython: Added the command line option Fix code in disable_glut which was not tested and quite buggy Tried to fix the CTRL-C problem (https://github.com/ipython/ipython/pull/742) and take other comments/typos into account Replaced deprecated raise call Fixed typos in comments Canceled window reshape to 1x1 since the idea is now for the user to use this window as the main one because of weird seg-faults problem after user creates its own window (any subsequent gl error would lead to a segfault, even a simple one line requiring a non existent function Event loop integration example Added code for the GLUT interactive session

File last commit:

r2564:bfd3d6a4
r4818:89161a5b merge
Show More
example-gnuplot.py
36 lines | 1017 B | text/x-python | PythonLexer
#!/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 IPython.\n'
'Try calling plot(x,y), or @gpc for direct access to Gnuplot"\n')
#********************** End of file <example-gnuplot.py> *********************