Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
import matplotlib.pyplot as plt import numpy as np t = np.linspace(-np.pi, np.pi, 1000) x1 = np.sin(2*t) x2 = np.cos(2*t) fig, (axL, axR) = plt.subplots(ncols=2, figsize=(10,4)) axL.plot(t, x1, linewidth=2) axL.set_title('sin') axL.set_xlabel('t') axL.set_ylabel('x') axL.set_xlim(-np.pi, np.pi) axL.grid(True) axR.plot(t, x2, linewidth=2) axR.set_title('cos') axR.set_xlabel('t') axR.set_ylabel('x')
Multiple subplots# Simple demo with multiple subplots. For more options, see Create multiple subplots using plt.subplots. import matplotlib.pyplot as plt import numpy as np # Create some fake data. x1 = np.linspace(0.0, 5.0) y1 = np.cos(2 * np.pi * x1) * np.exp(-x1) x2 = np.linspace(0.0, 2.0) y2 = np.cos(2 * np.pi * x2)
""" Shows how to combine Normalization and Colormap instances to draw "levels" in pcolor, pcolormesh and imshow type plots in a similar way to the levels keyword argument to contour/contourf. """ import matplotlib.pyplot as plt from matplotlib.colors import BoundaryNorm from matplotlib.ticker import MaxNLocator import numpy as np # make these smaller to increase the resolution dx, dy = 0.05, 0.05
You are reading an old version of the documentation (v2.0.2). For the latest version see https://matplotlib.org/stable/
matplotlib.pyplot.legend# matplotlib.pyplot.legend(*args, **kwargs)[source]# Place a legend on the Axes. Call signatures: legend() legend(handles, labels) legend(handles=handles) legend(labels) The call signatures correspond to the following different ways to use this method: 1. Automatic detection of elements to be shown in the legend The elements to be added to the legend are automatically deter
matplotlib.figure.Figure¶ class matplotlib.figure.Figure(figsize=None, dpi=None, facecolor=None, edgecolor=None, linewidth=0.0, frameon=None, subplotpars=None, tight_layout=None, constrained_layout=None)[source]¶ Bases: matplotlib.artist.Artist The top level container for all the plot elements. The Figure instance supports callbacks through a callbacks attribute which is a CallbackRegistry instanc
Matplotlib: Visualization with Python Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Matplotlib makes easy things easy and hard things possible. Create publication quality plots. Make interactive figures that can zoom, pan, update. Customize visual style and layout. Export to many file formats. Embed in JupyterLab and Graphical User I
import numpy as np import matplotlib.pyplot as plt # 押した時 def Press(event): global x1,y1,DragFlag # 値がNoneなら終了 if (event.xdata is None) or (event.ydata is None): return # 丸める cx = int(round(event.xdata)) cy = int(round(event.ydata)) x1 = cx y1 = cy # フラグをたてる DragFlag = True # ドラッグした時 def Drag(event): global x1,y1,x2,y2,DragFlag # ドラッグしていなければ終了 if DragFlag == False: return # 値がNoneなら終了 if (event.xd
pythonのmatplotlibで日本語を扱う Qiitaにもいくつかおんなじような記事あるんですが、なんか分かりにくかったので自分の為にまとめておく 状況としては、macOS Sierra でmatplotlibのデフォルトのフォントが日本語対応しておらず、▫︎▫︎▫︎に(豆腐というらしい) とりあえず、グラフに日本語が表示されてほしい! 手順 http://ipafont.ipa.go.jp/old/ipafont/download.html に行って、TTFファイルの4書体パックをダウンロード |font |name |family| ---|---|---|---| |ipagp.ttf | IPAPGothic| [sans-serif] |ipamp.ttf | IPAPMincho | [sans-serif] |ipam.ttf | IPAMincho | [sans-s
Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. import sys from datetime import datetime import matplotlib.pyplot as plt impo
Horizontal bar chart# This example showcases a simple horizontal bar chart. import matplotlib.pyplot as plt import numpy as np # Fixing random state for reproducibility np.random.seed(19680801) fig, ax = plt.subplots() # Example data people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim') y_pos = np.arange(len(people)) performance = 3 + 10 * np.random.rand(len(people)) error = np.random.rand(len(people))
Tight Layout guide¶ How to use tight-layout to fit plots within your figure cleanly. 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. An alternative to tight_layout is constrained_layout. Simple Example¶ In matplotli
matplotlib.patches.FancyArrowPatch# class matplotlib.patches.FancyArrowPatch(posA=None, posB=None, *, path=None, arrowstyle='simple', connectionstyle='arc3', patchA=None, patchB=None, shrinkA=2, shrinkB=2, mutation_scale=1, mutation_aspect=1, **kwargs)[source]# Bases: Patch A fancy arrow patch. It draws an arrow using the ArrowStyle. It is primarily used by the annotate method. For most purposes,
概要と環境 openCVの顔検出方法について調べて試してみました。入門者向けに解説します。 以下はopenCV関連記事です。 OpenCV3.3とPython3.6をAnacondaでWindows10へインストール openCVの顔検出でパラメータを指定して手っ取り早く検出精度を高める openCVで複数画像ファイルから顔検出をして切り出し保存 openCVで効率的に大量画像を顔検出するためのtips 検証環境は下記のとおりです。 openCVの顔検出でできたこと 人物画像に対して顔検知して四角枠で囲みました。 複数人でも大丈夫。すごい! 変顔だって検知します!(後ろの人も検知できてます) 顔検知から鼻検知に切り替えることもできます。 oepnCVの顔検出の仕組み 論文や具体的なアルゴリズムを見て調べて確認していないので、以降の解説は誤りがあるかもしれません(指摘いただけたら嬉しいです)
この記事はTSG Advent Calendar 2017/IS18er Advent Calendarの12日目の記事として書かれました。 (ちょっとタイトルが大げさすぎる?) はじめに こんなものをchainerで作りました。(アニメーションはmatplotlib) 以下で出てくるコードをまとめたものはここにあります。 ソースファイル 経緯 この間ネットサーフィンをしていたらこんなものを見つけました。 最適化数学で新年の挨拶(ニコニコ動画) 見てみると定点の周りを別の点が回り、さらにその点の周りを別の点が回り…を繰り返し、それらの点を結んでいろいろな図形を作っているようです。この動画では数字の2, 0, 9を描いていました。 これを僕も作りたい!と思ったので、この方のブログへ行き解説を読んでみました。(http://kogarashi.net/pitchblende/archives/
We’re getting things ready Loading your experience… This won’t take long.
Streamplot# A stream plot, or streamline plot, is used to display 2D vector fields. This example shows a few features of the streamplot function: Varying the color along a streamline. Varying the density of streamlines. Varying the line width along a streamline. Controlling the starting points of streamlines. Streamlines skipping masked regions and NaN values. Unbroken streamlines even when exceed
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く