{ "metadata": { "name": "", "signature": "sha256:83c0a40b5fb6f66a04a5cce49d27cb4aacda2d3862613976a6aaa18536355de0" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# View an image in iPython\n", "\n", "- **Author:** [Chris Albon](http://www.chrisalbon.com/), [@ChrisAlbon](https://twitter.com/chrisalbon)\n", "- **Date:** -\n", "- **Repo:** [Python 3 code snippets for data science](https://github.com/chrisalbon/code_py)\n", "- **Note:**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Display an image" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Load the ipython display and image module\n", "from IPython.display import Image\n", "from IPython.display import display" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "# display this image\n", "display(Image(url='http://history.nasa.gov/ap11ann/kippsphotos/5903.jpg'))" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "" ], "metadata": {}, "output_type": "display_data", "text": [ "" ] } ], "prompt_number": 6 }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Display an svg" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Load the svg module\n", "from IPython.display import SVG\n", "\n", "# Display an svg\n", "SVG(url='http://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg')" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 8, "svg": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "" ], "text": [ "" ] } ], "prompt_number": 8 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }