より良い読書体験のために、ポークしてください:
カタログ
Matplotlibの父である。
matplotlibグラフ構造
 figure 
 axes 
 matplotlib プロット
matplotlibプロットを描くための2つの方法
 方法1:matplotlibを使う.pyplot
 matplotlib.pyplot 
 pyplotプロット法の例
 方法2:オブジェクト指向アプローチ
 matplotlib.figure.Figure
 matplotlib.axes.Axes
 プロット用オブジェクト指向メソッドの例
Matplotlib の父。
['Annotation', 'Arrow', 'Artist', 'AutoLocator', 'Axes', 'Button', 'Circle', 'Figure', 'FigureCanvasBase', 'FixedFormatter', 'FixedLocator', 'FormatStrFormatter', 'Formatter', 'FuncFormatter', 'GridSpec', 'IndexLocator', 'Line2D', 'LinearLocator', 'Locator', 'LogFormatter', 'LogFormatterExponent', 'LogFormatterMathtext', 'LogLocator', 'MaxNLocator', 'MultipleLocator', 'Normalize', 'NullFormatter', 'NullLocator', 'Number', 'PolarAxes', 'Polygon', 'Rectangle', 'ScalarFormatter', 'Slider', 'Subplot', 'SubplotTool', 'Text', 'TickHelper', 'Widget', '_INSTALL_FIG_OBSERVER', '_IP_REGISTERED', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_auto_draw_if_interactive', '_backend_mod', '_get_running_interactive_framework', '_interactive_bk', '_log', '_pylab_helpers', '_setp', '_setup_pyplot_info_docstrings', '_show', 'acorr', 'angle_spectrum', 'annotate', 'arrow', 'autoscale', 'autumn', 'axes', 'axhline', 'axhspan', 'axis', 'axvline', 'axvspan', 'bar', 'barbs', 'barh', 'bone', 'box', 'boxplot', 'broken_barh', 'cbook', 'cla', 'clabel', 'clf', 'clim', 'close', 'cm', 'cohere', 'colorbar', 'colormaps', 'connect', 'contour', 'contourf', 'cool', 'copper', 'csd', 'cycler', 'dedent', 'delaxes', 'deprecated', 'disconnect', 'docstring', 'draw', 'draw_all', 'draw_if_interactive', 'errorbar', 'eventplot', 'figaspect', 'figimage', 'figlegend', 'fignum_exists', 'figtext', 'figure', 'fill', 'fill_between', 'fill_betweenx', 'findobj', 'flag', 'functools', 'gca', 'gcf', 'gci', 'get', 'get_backend', 'get_cmap', 'get_current_fig_manager', 'get_figlabels', 'get_fignums', 'get_plot_commands', 'get_scale_docs', 'get_scale_names', 'getp', 'ginput', 'gray', 'grid', 'hexbin', 'hist', 'hist2d', 'hlines', 'hot', 'hsv', 'importlib', 'imread', 'imsave', 'imshow', 'inferno', 'inspect', 'install_repl_displayhook', 'interactive', 'ioff', 'ion', 'isinteractive', 'jet', 'legend', 'locator_params', 'logging', 'loglog', 'magma', 'magnitude_spectrum', 'margins', 'matplotlib', 'matshow', 'minorticks_off', 'minorticks_on', 'mlab', 'new_figure_manager', 'nipy_spectral', 'np', 'pause', 'pcolor', 'pcolormesh', 'phase_spectrum', 'pie', 'pink', 'plasma', 'plot', 'plot_date', 'plotfile', 'plotting', 'polar', 'prism', 'psd', 'pylab_setup', 'quiver', 'quiverkey', 'rc', 'rcParams', 'rcParamsDefault', 'rcParamsOrig', 'rc_context', 'rcdefaults', 'rcsetup', 're', 'register_cmap', 'rgrids', 'savefig', 'sca', 'scatter', 'sci', 'semilogx', 'semilogy', 'set_cmap', 'set_loglevel', 'setp', 'show', 'silent_list', 'specgram', 'spring', 'spy', 'stackplot', 'stem', 'step', 'streamplot', 'style', 'subplot', 'subplot2grid', 'subplot_tool', 'subplots', 'subplots_adjust', 'summer', 'suptitle', 'switch_backend', 'sys', 'table', 'text', 'thetagrids', 'tick_params', 'ticklabel_format', 'tight_layout', 'time', 'title', 'tricontour', 'tricontourf', 'tripcolor', 'triplot', 'twinx', 'twiny', 'uninstall_repl_displayhook', 'violinplot', 'viridis', 'vlines', 'waitforbuttonpress', 'warn_deprecated', 'winter', 'xcorr', 'xkcd', 'xlabel', 'xlim', 'xscale', 'xticks', 'ylabel', 'ylim', 'yscale', 'yticks']
matplotlib グラフ構造
figure
地図全体を指し、地図全体の解像度、アスペクト、タイトル、その他の特性を設定できます;
複数の軸を含むことができ、単純に複数のサブ図として解釈できます;
 図はキャンバスシステムレイヤーの上に配置され、ユーザーには見えません。 
axes
サブダイヤグラムごとに、棒グラフ、円グラフ、箱ひげ図など、さまざまなグラフを描くことができます;
各グラフのグリッド線、軸のスイッチなどを設定します;
各軸の名前、副図のタイトル、凡例などの設定;
軸の範囲、軸のスケールなどの設定;次の図は2つの軸を持っています: 
matplotlib プロット
以下のページでは、Pythonのオブジェクト指向とモジュールに関する簡単な知識を説明します:
jhepc.github.io/about.html
3, matplotlib 二つのプロット描画方法
他の人のプロットコードを見ると、同じグラフが2つの全く異なる方法でプロットされていることがよくあります。おそらく、pyplotメソッドと2つのオブジェクト指向実装を使っているからでしょう。
方法 1: matplotlib を使う.pyplot
- matplotlib.pyplot
この種のプロットは主にpyplotモジュールを使用します。pyplot.pyは3,000行以上のコードがあり、スクリプト内部にはdefで定義された関数がたくさんあり、プロットはpyplot.pyの関数を呼び出すことです。以下のようにpyplotの全てのプロパティを表示し、プロット時に必要に応じて以下のプロパティを使用することができます。サブモジュール、名詞属性、関数の詳細についてはmatplotlib.org/api/_as_gen... を参照してください。
- pyplotプロット法の例
#matplotlib.pyplot  
import numpy as np
import matplotlib.pyplot as plt#pyplotをインポートする,matplotlib.pyplotpltと略す
def f(t):
 return np.exp(-t) * np.cos(2*np.pi*t)
t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)
plt.figure(dpi=100)
plt.subplot(211)
plt.plot(t1, f(t1), color='tab:blue', marker='o')
plt.plot(t2, f(t2), color='black')
plt.title('demo')
plt.subplot(212)
plt.plot(t2, np.cos(2*np.pi*t2), color='tab:orange', linestyle='--')
plt.suptitle('matplotlib.pyplot api')
plt.show()
方法論 II: オブジェクト指向アプローチ
オブジェクト指向のアプローチは、より複雑な図形を描くときに便利です。この描画方法では、主に matplotlib の 2 つのサブクラス matplotlib.figure.Figure と matplotlib.axes.Axes を使用します。各図を描画するとき、キャンバスは matplotlib.figure.Figure のインスタンスであり、各サブ図は matplotlib.figure.Figure のインスタンスです。それぞれ、Axes.Axes は親クラスのメソッドをすべて継承できるので、描画時に、設定したい要素を両方のプロパティから見つけて利用することができます。
- matplotlib.figure.
このオブジェクトは主に図形の調整に使用され、以下のプロパティを持っています:matplotlib.org/api/_as_gen...
- matplotlib.axes.
このオブジェクトは主に configure の各軸を調整するために使用され、名詞の属性と関数を持っています
import numpy as np
import matplotlib.pyplot as plt
def f(t):
 return np.exp(-t) * np.cos(2*np.pi*t)
t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)
fig, axs = plt.subplots(2, dpi=100)
#figmatplotlib の場合.figure.Figureオブジェクト figure のインスタンス
#axsmatplotlib の場合.axes.Axesnumpyで構成されるオブジェクトのインスタンス.ndarray
axs[0].plot(t1, f(t1), color='tab:blue', marker='o')
axs[0].plot(t2, f(t2), color='black')
#タイトルを設定する2つの方法
#axs[0].set_title('haha')#matplotlibを使う.axes.Axesのセットである。_title小見出しを設定するメソッド
axs[0].set(title='demo1')
axs[1].plot(t2, np.cos(2*np.pi*t2), color='tab:orange', linestyle='--')
fig.suptitle('matplotlib object-oriented')#matplotlibを使う.figure.Figureメソッドで図のタイトルを設定する。
plt.show()
パブリック・ナンバーへようこそ:ピトニック・バイオロジカル・ピープル





