タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

matplotlibに関するshoronpooのブックマーク (1)

  • matplotlibで領域の図示 - 気ままに宙をみる

    matplotlibで領域に色を付けてみたのでメモ。 fill_between関数fill関数を使うと大体できます。 sin(x)とcos(x)の間の領域に色を付ける。 まずはsin(x)とcos(x)の間に色を付けてみます。 fill_betweenは3つの変数を取ります。 x: x軸の範囲指定 y1,y2: この2つの間を塗りつぶす あとはオプションでfacecolorは色、alphaは透過度なんかを指定できます。 import numpy as np import matplotlib.pyplot as plt from math import * x = np.arange(0,10,0.01) y1 = np.sin(x) y2 = np.cos(x) plt.fill_between(x,y1,y2,facecolor='y',alpha=0.5) plt.show() 条件

    matplotlibで領域の図示 - 気ままに宙をみる
    shoronpoo
    shoronpoo 2017/10/03
    領域作図
  • 1