Home

Recent
Archive

Numerical experiments, Tips, Tricks and Gotchas

Numerically speaking

IPythpn notebook inline graphics

This is yet another reference for myself.

In order to activate inline grafics, it usually recomended to call
%pylab inline
However, according to the documentation [1], this command makes a lot of imports:
import numpy
import matplotlib
from matplotlib import pylab, mlab, pyplot
np = numpy
plt = pyplot

from IPython.display import display
from IPython.core.pylabtools import figsize, getfigs

from pylab import *
from numpy import *
I found this light-weight substitution on the Internet [ 2] and use since:
%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
or [3]
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

 

References

  1. Built-in magic commands.
  2. How to make ipython notebook inline matplotlib graphics.
  3. What is %pylab?

 

© Nikolai Shokhirev, 2012-2024

email: nikolai(dot)shokhirev(at)gmail(dot)com

Count: