rainit2006 / Python-room

my python room
0 stars 0 forks source link

Graphic View #17

Open rainit2006 opened 5 years ago

rainit2006 commented 5 years ago

动画3D

rainit2006 commented 5 years ago
rainit2006 commented 5 years ago

Plotly 实现3D图像(支持camera view变换) https://plot.ly/python/3d-scatter-plots/

安装: 通过ANACONDA 或者 PyCharm

Pythonで3D表示させるために、比較的手軽に利用できるMayavi を利用しました。 https://qiita.com/RyoNu/items/c5ba6fd27a3c8825f640

rainit2006 commented 5 years ago

Matplotlib

evenly sampled time at 200ms intervals

t = np.arange(0., 5., 0.2)

red dashes, blue squares and green triangles

plt.plot(t, t, 'r--', t, t2, 'bs', t, t3, 'g^') plt.show()

![image](https://user-images.githubusercontent.com/12871721/29440129-5ae76926-83fd-11e7-885f-76af71fb4b6d.png)

- legend()
Places a legend(説明文) on the axes.

--------------------------------------------------
DataFrame has plot() method as well.

ex, I want to plot the last 500 datas of a dataframe.

df = df.tail(500) df['adj_close'].plot() df['Forecast'].plot() plt.legend(loc=4) plt.xlabel('Date') plt.ylabel('Price') plt.show()


---------------------------
- scatter
散布図 (Scatter plot) を描く

import numpy as np import matplotlib.pyplot as plt

乱数を生成

x = np.random.rand(100) y = np.random.rand(100)

散布図を描画

plt.scatter(x, y)


- style
http://qiita.com/eriksoon/items/b93030ba4dc686ecfbba

- Figure
matplotlib の Figure オブジェクトはプロット機能を提供します。 plt.figure() メソッドは何も描画されていない新しいウィンドウを描画します。 add_subplot() メソッドはその内部にサブプロットを生成します。
plt.figure()にグラフを描画するためにsubplotを追加する必要がある。 subplotの追加は、add_subplotメソッドを使用する。

fig = plt.figure() fig.add_subplot(111, projection='3d') //111の意味は、1行目1列の1番目という意味 ///projection='3d', creating a 3D axes.