Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

matplotlibで日本語を使おうとすると、デフォルトのままでは文字化けしてしまいます。 そこで文字化けしないようにするための設定を紹介します。 お困りごと Jupyter Notebook上で以下のような処理を実行したときに グラフのラベルが上手く表示されない。 from numpy.random import * from matplotlib import pyplot as plt %matplotlib inline # 乱数生成 rand_nums = randn(100) # ヒストグラム表示 plt.hist(rand_nums) plt.xlabel("X軸と表示したい") plt.ylabel("Y軸と表示したい") 実行結果 環境 MacOS、Python 3.6(Anaconda)、Jupyter Notebookがインストールされている環境。 準備 以下のサイト
Gnuplottingが公開しているカラーマップを利用して,matplotlibで描いたような美しい配色の3Dグラフをgnuplotで描けるテンプレートを作成しました.次に示すような2種類を用意してあります.論文などに使えそうです. 環境 OS: Windows 7 Gnuplot Version 5.2.4 準備 初めに,GnuplottingがGitHub上で公開しているカラーパレットをダウンロードしておきます.これらのカラーパレットファイル (.pal) をgnuplotファイルがあるディレクトリに置き,gnuplotファイルの冒頭に次の一行を書けば3Dグラフの色が変更されます. #================================ # drawing settings #================================ load 'palette.pa
はじめに 錯視(目の錯覚)はいろいろなところで見かけますよね. 例えば, エッシャーの『上昇と下降』(ペンローズの階段)はみなさんご存知かと思います. 今回は, この「無限に続く階段」を聴覚情報, すなわち音で再現してみます. この「無限に高く(低く)なっていく音」は1964年にベル研究所のRoger N. Shepardが考案した「1オクターブ上がっても最初と同じに聞こえる音」を発展させたもので, 「シェパードトーン(無限音階)」と呼ばれています. まずは完成した音を聞いてみてください. Audio illusion: Shepard tone (upward) - YouTube Audio illusion: Shepard tone (downward) - YouTube おもしろいですよね? ちなみに, シェパードトーンは映画や音楽でもときどき登場します. 特にChristop
$ python --version Python 3.6.5 :: Anaconda, Inc. $ pip list matplotlib 2.2.2 --- radar_chart.py.org +++ radar_chart.py @@ -39,6 +39,7 @@ theta = np.linspace(0, 2*np.pi, num_vars, endpoint=False) # rotate theta such that the first axis is at the top theta += np.pi/2 + theta = np.where(theta > np.pi * 2, theta - np.pi*2, theta) def draw_poly_patch(self): verts = unit_poly_verts(theta)
確率密度推定のモデル データ標本から確率密度関数を推定する方法は、一般的に2つに大別できる。 パラメトリックモデル: 母集団が正規分布やガンマ分布などであることを想定するモデル ノンパラメトリックモデル: 母集団の分布を想定しないモデル。 手法 ここでは、ノンパラメトリックの代表的な手法と言えるKDE(Kernel Density Estimation)を用いて、標本の確率密度関数を推定する。 KDEは、標本に対して複数のカーネルを適用し、それらのカーネルの重ね合わせでデータ標本の確率密度関数を推定する方法である。 KDEライブラリ Python環境では、KDEを実装している主要なライブラリはいくつかある。 scikit-learn scipy statsmodels 今回はscikit-learnを用いる。 1次元の場合 正規分布に従うランダムな値を生成する。 ここでは、2つの異なる正規
内容 デジタル画像としての大きさの単位であるピクセルと物理的な長さを示すインチを混乱しないようにしよう。 matplotlibで出力される画像の大きさは、ピクセル単位で表わすと、plt.rcParams["figure.dpi"] × plt.rcParams["figure.figsize"]で計算される。 一方matplotlib内のフォントサイズを表現する時にはポイントで指定する。ポイントとは、1/72インチなので物理的な長さの単位であり、ピクセルではない。 そのため、図中の相対的な大きさを考えてフォントサイズを指定したい時には、plt.rcParams["figure.figsize"]で指定する値との大小のみを考えて指定する必要がある。 環境 matplotlib 2.1.1 イントロ matplotlibにはいつも大変お世話になっております。データのグラフ化などすごく簡単に素早
今回は matplotlib を使って動的にグラフを生成する方法について。 ここでいう動的というのは、データを逐次的に作って、それを随時グラフに反映していくという意味を指す。 例えば機械学習のモデルを学習させるときに、その過程 (損失の減り方とか) を眺める用途で便利だと思う。 使った環境は次の通り。 $ sw_vers ProductName: Mac OS X ProductVersion: 10.13.5 BuildVersion: 17F77 $ python -V Python 3.6.5 $ pip list --format=columns | egrep -i "(matplotlib|pillow)" matplotlib 2.2.2 Pillow 5.2.0 もくじ もくじ 下準備 静的にグラフを生成する 動的にグラフを生成する グラフを延々と描画し続ける Jupyte
Tricontour Vs Griddata¶ Comparison of griddata and tricontour for an unstructured triangular grid. Out: from __future__ import print_function import matplotlib.pyplot as plt import matplotlib.tri as tri import numpy as np import matplotlib.mlab as mlab import time np.random.seed(0) npts = 200 ngridx = 100 ngridy = 200 x = np.random.uniform(-2, 2, npts) y = np.random.uniform(-2, 2, npts) z = x * np
Tight Layout guide¶ tight_layout automatically adjusts subplot params so that the subplot(s) fits in to the figure area. This is an experimental feature and may not work for some cases. It only checks the extents of ticklabels, axis labels, and titles. Simple Example¶ In matplotlib, the location of axes (including subplots) are specified in normalized figure coordinates. It can happen that your ax
Overview¶ The idea behind choosing a good colormap is to find a good representation in 3D colorspace for your data set. The best colormap for any given data set depends on many things including: Whether representing form or metric data ([Ware]) Your knowledge of the data set (e.g., is there a critical value from which the other values deviate?) If there is an intuitive color scheme for the paramet
import matplotlib.pyplot as plt import numpy as np from matplotlib import cbook from mpl_toolkits.axes_grid1 import ImageGrid def add_inner_title(ax, title, loc, **kwargs): from matplotlib.offsetbox import AnchoredText from matplotlib.patheffects import withStroke prop = dict(path_effects=[withStroke(foreground='w', linewidth=3)], size=plt.rcParams['legend.fontsize']) at = AnchoredText(title, loc=
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く