How to make IPython notebook matplotlib plot inline

Ian Fiske

I am trying to use IPython notebook on MacOS X with Python 2.7.2 and IPython 1.1.0.

I cannot get matplotlib graphics to show up inline.

import matplotlib
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline  

I have also tried %pylab inline and the ipython command line arguments --pylab=inline but this makes no difference.

x = np.linspace(0, 3*np.pi, 500)
plt.plot(x, np.sin(x**2))
plt.title('A simple chirp')
plt.show()

Instead of inline graphics, I get this:

<matplotlib.figure.Figure at 0x110b9c450>

And matplotlib.get_backend() shows that I have the 'module://IPython.kernel.zmq.pylab.backend_inline' backend.

eNord9

I used %matplotlib inline in the first cell of the notebook and it works. I think you should try:

%matplotlib inline

import matplotlib
import numpy as np
import matplotlib.pyplot as plt

You can also always start all your IPython kernels in inline mode by default by setting the following config options in your config files:

c.IPKernelApp.matplotlib=<CaselessStrEnum>
  Default: None
  Choices: ['auto', 'gtk', 'gtk3', 'inline', 'nbagg', 'notebook', 'osx', 'qt', 'qt4', 'qt5', 'tk', 'wx']
  Configure matplotlib for interactive use with the default matplotlib backend.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to make inline plots in Jupyter Notebook larger?

From Java

How to set the matplotlib figure default size in ipython notebook?

From Java

How to dynamically update a plot in a loop in Ipython notebook (within one cell)

From Java

Automatically run %matplotlib inline in IPython Notebook

From Dev

IPython Notebook widgets for Matplotlib interactivity

From Dev

How to hide <matplotlib.lines.Line2D> in IPython notebook

From Dev

How to make new cells in ipython notebook markdown by default?

From Dev

Inline math mode on iPython notebook

From Dev

Plot inside Ipython Notebook

From Dev

Cannot plot inline with ipython notebook

From Dev

pandas plot doesn't show in ipython notebook as inline

From Dev

IPython Notebook: How to combine HTML output and matplotlib figures?

From Dev

iPython/Jupyter Notebook and Pandas, how to plot multiple graphs in a for loop?

From Dev

How to keep the current figure when using ipython notebook with %matplotlib inline?

From Dev

How to display print statements interlaced with matplotlib plots inline in Ipython?

From Dev

How to make multi-file upload widget in Ipython Notebook?

From Dev

How do you make NLTK draw() trees that are inline in iPython/Jupyter

From Dev

Dynamically update plot in iPython notebook

From Dev

IPython Notebook/Matplotlib: Interactive show/hide graphs on a plot, is it possible?

From Dev

Inline display when using GalSim on iPython Notebook

From Dev

Cannot close plot generated with matplotlib in ipython notebook

From Dev

How do I provide inline input to an IPython (notebook) shell command?

From Dev

Plot inside Ipython Notebook

From Dev

How to make IPython Notebook not show results of the previous session?

From Dev

How to set and display x/y label with pandas plot in ipython notebook?

From Dev

How to make multi-file upload widget in Ipython Notebook?

From Dev

Matplotlib: How to make a contour plot?

From Dev

How to make a progresing plot in matplotlib

From Dev

matplotlib how to show plot when not in jupyter notebook

Related Related

  1. 1

    How to make inline plots in Jupyter Notebook larger?

  2. 2

    How to set the matplotlib figure default size in ipython notebook?

  3. 3

    How to dynamically update a plot in a loop in Ipython notebook (within one cell)

  4. 4

    Automatically run %matplotlib inline in IPython Notebook

  5. 5

    IPython Notebook widgets for Matplotlib interactivity

  6. 6

    How to hide <matplotlib.lines.Line2D> in IPython notebook

  7. 7

    How to make new cells in ipython notebook markdown by default?

  8. 8

    Inline math mode on iPython notebook

  9. 9

    Plot inside Ipython Notebook

  10. 10

    Cannot plot inline with ipython notebook

  11. 11

    pandas plot doesn't show in ipython notebook as inline

  12. 12

    IPython Notebook: How to combine HTML output and matplotlib figures?

  13. 13

    iPython/Jupyter Notebook and Pandas, how to plot multiple graphs in a for loop?

  14. 14

    How to keep the current figure when using ipython notebook with %matplotlib inline?

  15. 15

    How to display print statements interlaced with matplotlib plots inline in Ipython?

  16. 16

    How to make multi-file upload widget in Ipython Notebook?

  17. 17

    How do you make NLTK draw() trees that are inline in iPython/Jupyter

  18. 18

    Dynamically update plot in iPython notebook

  19. 19

    IPython Notebook/Matplotlib: Interactive show/hide graphs on a plot, is it possible?

  20. 20

    Inline display when using GalSim on iPython Notebook

  21. 21

    Cannot close plot generated with matplotlib in ipython notebook

  22. 22

    How do I provide inline input to an IPython (notebook) shell command?

  23. 23

    Plot inside Ipython Notebook

  24. 24

    How to make IPython Notebook not show results of the previous session?

  25. 25

    How to set and display x/y label with pandas plot in ipython notebook?

  26. 26

    How to make multi-file upload widget in Ipython Notebook?

  27. 27

    Matplotlib: How to make a contour plot?

  28. 28

    How to make a progresing plot in matplotlib

  29. 29

    matplotlib how to show plot when not in jupyter notebook

HotTag

Archive