figureの使い方(matplotlib)



Python
Pythonとは
基本的な使い方
IDLE
Jupyter Notebook
Markdown
コマンドプロンプトで実行
仮想環境の構築
仮想環境でIDLEを実行
ライブラリのインストール
pipの使い方
numpy , matplotlib等
graphviz
pytorch
Mecab
Pythonの関数:一覧
共通関数
append , extend
class
copy
csv.reader
csv.writer
def , return
dict , defaultdict
enumerate
exit
for
if
import
in
input
lambda
len
list
min/max
OrderedDict
open/close
os
pickle
print
range
re.split
read/readline
round/floor/ceil
split
sys.argv
time
while
write
zip
・特殊メソッド
 ・__name__
 ・__iter__ , __next__
正規表現、メタ文字
データの型の種類
四則演算 (+ , - , * , /)
コメントアウト (# , ''')
numpy
append
arange
argmax/argmin
array
asfarray
astype , dtype
digitize
dot
hstack/vstack
linalg.solve
linspace
mean
meshgrid
mgrid
ndim
ndmin
pad
poly1d
polyfit
prod
random
reshape
savetxt/loadtxt
shape
std
transpose
where
zeros/zeros_like
scipy
expit
imread
interpolate
matplotlib
imshow
figure
pcolormesh
plot
scatter
scikit-learn
GaussianNB
KMeans
KNeighborsClassifier
SVC
tree
keras
chainer
chainerrl
pytorch
BCELoss , MSELoss
Embedding
device
Sequential
Dataset, Dataloader
RNN, LSTM
OpenAI gym
Blackjack-v0
CartPole-v0
tkinter
frame, grid
画像表示
画像を切り取り表示
画像を保存
目的別
ステップ関数
1 of K 符号化法
線形補間
配列に番号をつける

公開日:2019/12/22         

■説明
グラフを複数描画します。

■具体例
以下は各具体例で共通に記載する必要があります。matplotlibのインストールはこちら

>> import matplotlib.pyplot as plt
>> import numpy as np  # figureを使うために必須ではなく今回arangeを使うために定義


例①
1つのウィンドウで表示する場合は以下。

x=np.arange(10)
y1=x*2
y2=x*x

plt.figure()

plt.subplot(2,1,1)   # 2行1列のグラフの1番目に定義
plt.plot(x, y1)

plt.subplot(2,1,2)  # 2行1列のグラフの2番目に定義
plt.plot(x, y2)

plt.show()



例②
複数のウィンドウで表示する場合は以下。

x=np.arange(10)
y1=x*2
y2=x*x

plt.figure()
plt.plot(x, y1)

plt.figure()
plt.plot(x, y2)

plt.show()











サブチャンネルあります。⇒ 何かのお役に立てればと

関連記事一覧



Python
Pythonとは
基本的な使い方
IDLE
Jupyter Notebook
Markdown
コマンドプロンプトで実行
仮想環境の構築
仮想環境でIDLEを実行
ライブラリのインストール
pipの使い方
numpy , matplotlib等
graphviz
pytorch
Mecab
Pythonの関数:一覧
共通関数
append , extend
class
copy
csv.reader
csv.writer
def , return
dict , defaultdict
enumerate
exit
for
if
import
in
input
lambda
len
list
min/max
OrderedDict
open/close
os
pickle
print
range
re.split
read/readline
round/floor/ceil
split
sys.argv
time
while
write
zip
・特殊メソッド
 ・__name__
 ・__iter__ , __next__
正規表現、メタ文字
データの型の種類
四則演算 (+ , - , * , /)
コメントアウト (# , ''')
numpy
append
arange
argmax/argmin
array
asfarray
astype , dtype
digitize
dot
hstack/vstack
linalg.solve
linspace
mean
meshgrid
mgrid
ndim
ndmin
pad
poly1d
polyfit
prod
random
reshape
savetxt/loadtxt
shape
std
transpose
where
zeros/zeros_like
scipy
expit
imread
interpolate
matplotlib
imshow
figure
pcolormesh
plot
scatter
scikit-learn
GaussianNB
KMeans
KNeighborsClassifier
SVC
tree
keras
chainer
chainerrl
pytorch
BCELoss , MSELoss
Embedding
device
Sequential
Dataset, Dataloader
RNN, LSTM
OpenAI gym
Blackjack-v0
CartPole-v0
tkinter
frame, grid
画像表示
画像を切り取り表示
画像を保存
目的別
ステップ関数
1 of K 符号化法
線形補間
配列に番号をつける