LoginSignup
17
17

More than 5 years have passed since last update.

IPython Notebookでグラフ描画

Last updated at Posted at 2014-07-17

IPython Notebookのインストール

環境: Ubuntu 14.04LTS

IPython Notebookのインストール

$ sudo apt-get install ipython-notebook

数値計算ライブラリや、グラフ描画ライブラリのインストール

$ sudo apt-get install python-matplotlib python-scipy python-pandas python-sympy python-nose

IPython Notebookの起動

$ ipython notebook

とコマンドを打つと、IPython Notebookがブラウザ上で起動する

ipython_new.png

例:3Dバブルチャートを描画する

from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.gca(projection='3d')
colors = ('r', 'g', 'b', 'k')
for c in colors:
    x = np.random.sample(30)
    y = np.random.sample(30)
    ax.scatter(x, y, 0, zdir='y', c=c)

ax.legend()
ax.set_xlim3d(0, 1)
ax.set_ylim3d(0, 1)
ax.set_zlim3d(0, 1)

plt.show()

ipython_notebook.png

17
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
17