iPython Example
{title} {text}
>iPython Example
Starting pylab | %logstart | %logoff | ipython notebook |
ipython notebook --pylab | ipython notebook --pylab inline |
||
Python Table of Content |
Starting pylab
{title} {text} >>
quit() or Ctrl + D quits the IPython shell.
Using in cmd
C:\Program Files>ipython -pylab
WARNING: `-pylab` flag has been deprecated.
Use `--matplotlib
>
Using PowerShell
PS C:\Users\Tom> ipython -pylab WARNING: `-pylab` flag has been deprecated. Use `--matplotlib>` and import pylab manually. Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. IPython 2.3.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. Using matplotlib backend: TkAgg In [1]: quit() PS C:\Users\Tom>
Using Git
Tom@TOM-GATEWAYPC ~/Web-Project/GitHub/git-project (master) $ ipython -pylab WARNING: `-pylab` flag has been deprecated. Use `--matplotlib>` and import pylab manually. Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. IPython 2.3.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. Using matplotlib backend: TkAgg In [1]: quit() Tom@TOM-GATEWAYPC ~/Web-Project/GitHub/git-project (master) $
ipython notebook
{title} {text} >>
Starting a notebook with the following code:
ipython notebook
The notebook is opened in your default browser
PS C:\Users\Tom> ipython notebook
2014-10-28 14:05:57.151 [NotebookApp] Using existing profile dir: 'C:\\emacs\\.ipython\\profile_default'
2014-10-28 14:05:57.198 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
2014-10-28 14:05:57.385 [NotebookApp] Serving notebooks from local directory: C:\Users\Tom
2014-10-28 14:05:57.385 [NotebookApp] 0 active kernels
2014-10-28 14:05:57.385 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/
2014-10-28 14:05:57.385 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirm
ation).
>
ipython notebook --pylab
{title} {text} >>
Starting a notebook with the following code:
ipython notebook --pylab
This loads the Scipy, NumPy, and Matplotlib modules.
The notebook is opened in your default browser
PS C:\Users\Tom> ipython notebook --pylab 2014-10-28 14:30:59.300 [NotebookApp] Using existing profile dir: 'C:\\emacs\\.ipython\\profile_default' 2014-10-28 14:30:59.300 [NotebookApp] WARNING | Starting all kernels in pylab mode is not recommended, and will be disabled in a future release. Please use the %matplotlib magic to enable matplotlib instead. pylab implies many imports, which can have confusing side effects and harm the reproducibility of your notebooks. 2014-10-28 14:30:59.347 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js 2014-10-28 14:30:59.440 [NotebookApp] Serving notebooks from local directory: C:\Users\Tom 2014-10-28 14:30:59.440 [NotebookApp] 0 active kernels 2014-10-28 14:30:59.440 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/ 2014-10-28 14:30:59.440 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirm ation).>
ipython notebook --pylab inline
{title} {text} >>
ipython notebook --pylab inline
Display inline Matplotlib plots with the inline directive, using the following command:
PS C:\Users\Tom> ipython notebook --pylab inline
2014-10-28 14:40:29.267 [NotebookApp] Using existing profile dir: 'C:\\emacs\\.ipython\\profile_default'
2014-10-28 14:40:29.269 [NotebookApp] WARNING | Starting all kernels in pylab mode is not recommended,
and will be disabled in a future release.
Please use the %matplotlib magic to enable matplotlib instead.
pylab implies many imports, which can have confusing side effects
and harm the reproducibility of your notebooks.
2014-10-28 14:40:29.309 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
2014-10-28 14:40:29.406 [NotebookApp] Serving notebooks from local directory: C:\Users\Tom
2014-10-28 14:40:29.406 [NotebookApp] 0 active kernels
2014-10-28 14:40:29.406 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/
2014-10-28 14:40:29.407 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirm
ation).
>
1. Create a notebook: Click on the New Notebook button to create a new notebook:
2. Create an array: Create an array with the arange function. Type the command in the following screenshot, and press Enter:
a = arange(7)
3. Next, enter the following command and press Enter
a
