emout.plot package

Submodules

emout.plot.animation_plot module

class emout.plot.animation_plot.Animator(layout)[source]

Bases: object

property frames

管理いているFrameUpdaterの最小フレーム数.

plot(fig=None, action='to_html', filename=None, interval=200, repeat=True, show=False, savefilename=None, to_html=False)[source]

gifアニメーションを作成する

Parameters:
  • fig (Figure) – アニメーションを描画するFigure(Noneの場合新しく作成する), by default None

  • action ({'return', 'show', 'to_html', 'save'}, optional, by default 'to_html') –

    Determines the behavior of the function:

    • ’return’: The plot object (fig, ani) is returned without rendering it.

    • ’show’: The plot is displayed immediately.

    • ’to_html’: The plot is converted to an Ipython.display.HTML object and returned.

    • ’save’: The plot is saved to a file specified by ‘filename’ argument.

  • filename (str, optional) – 保存するファイル名(actionが’save’以外の場合やNoneの場合保存されない), by default None

  • interval (int, optional) – フレーム間のインターバル(ミリ秒), by default 400

  • repeat (bool) – アニメーションをループするならTrue, by default True

  • show (bool, optional) –

    プロットを表示する場合True(ファイルに保存する場合は非表示), by default

    Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the ‘action’=’show’ instead for equivalent functionality.

  • savefilename (str, optional) –

    保存するファイル名(Noneの場合保存しない), by default None

    Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the plot(‘action’=’save’, filename=’example.gif’) instead for equivalent functionality.

  • to_html (bool) –

    アニメーションをHTMLとして返す. (使用例: Jupyter Notebook等でアニメーションを描画する際等)

    Deprecated since version 1.2.1: This parameter is deprecated and will be removed in version 2.0.0. Use the ‘action’=’to_html’ instead for equivalent functionality.

Returns:

  • Depending on the selected action

  • - If ‘return’ (Returns the tuple of the plot object (fig, animation).)

  • - If ‘show’ (Does not return anything, displays the plot.)

  • - If ‘to_html’ (Returns an Ipython.display.HTML object of the plot (for Jupyter).)

  • - If ‘save’ (Does not return anything, saves the plot to a file.)

Examples

>>> fig, ani = plot(action="return")
Returns the tuple of the plot object.
>>> plot(action="show")
Displays the plot.
>>> html = plot(action="to_html")
Returns the HTML representation of the plot.
>>> plot(action="save", filename = "example.gif")
Saves the plot to a file.
property shape

レイアウトの形状.

class emout.plot.animation_plot.FrameUpdater(data, axis=0, title=None, notitle=False, offsets=None, use_si=True, **kwargs)[source]

Bases: object

to_animator(layout=None)[source]

アニメーターに変換する.

Parameters:

layout (List[List[List[FrameUpdater]]]) – アニメーションプロットのレイアウト

update(i)[source]
emout.plot.animation_plot.flatten_list(l)[source]

emout.plot.basic_plot module

emout.plot.basic_plot.figsize_with_2d(data2d, dpi=10)[source]

2次元データから図のサイズを計算する.

Parameters:
  • data2d (numpy.ndarray) – 2次元データ

  • dpi (int, optional) – 1データを何pixelで表すか, by default 10

Returns:

図のサイズ

Return type:

(float, float)

emout.plot.basic_plot.plot_2d_contour(data2d, mesh=None, levels=None, colors=['black'], cmap=None, alpha=1, vmin=None, vmax=None, savefilename=None, figsize=None, xlabel=None, ylabel=None, title=None, dpi=10, fmt='%1.1f', fontsize=12, **kwargs)[source]

2次元等高線をプロットする.

Parameters:
  • data2d (numpy.ndarray) – 2次元データ

  • mesh ((numpy.ndarray, numpy.ndarray), optional) – メッシュ, by default None

  • levels (int) – 等高線数, by default None

  • alpha (float) – 透明度(0.0~1.0), by default 1

  • savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None

  • cmap (matplotlib.Colormap or str or None, optional) – カラーマップ, by default None

  • mask_color (str) – マスクされた位置の色, by default ‘gray’

  • vmin (float, optional) – 最小値, by default None

  • vmax (float, optional) – 最大値, by default None

  • figsize ((float, float), optional) – 図のサイズ, by default None

  • xlabel (str, optional) – x軸のラベル, by default None

  • ylabel (str, optional) – y軸のラベル, by default None

  • title (str, optional) – タイトル, by default None

  • interpolation (str, optional) – 用いる補間方法, by default ‘bilinear’

  • dpi (int, optional) – 解像度(figsizeが指定された場合は無視される), by default 10

  • fmt (str) – clabelの形式, by default ‘%1.1f’

  • fontsize (str) – clabelのフォントサイズ, by default 12

Returns:

プロットしたimageデータ(保存した場合None)

Return type:

AxesImage or None

emout.plot.basic_plot.plot_2d_streamline(x_data2d, y_data2d, mesh=None, savefilename=None, skip=1, figsize=None, xlabel=None, ylabel=None, title=None, dpi=10, color=None, cmap=None, norm='linear', vmin=None, vmax=None, density=1, **kwargs)[source]

2次元ベクトル図をプロットする.

Parameters:
  • x_data2d (numpy.ndarray) – 2次元データ

  • y_data2d (numpy.ndarray) – 2次元データ

  • mesh ((numpy.ndarray, numpy.ndarray), optional) – メッシュ, by default None

  • savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None

  • color (str) – ベクトルの色, by default None

  • scale (float) – ベクトルの大きさ係数(最終的な大きさにこの値を掛ける), by default 1

  • skip (int) – プロットするデータ間隔, by default 1

  • easy_to_read (bool) – ベクトルを見やすい大きさにスケーリングするならTrue, by default True

  • figsize ((float, float), optional) – 図のサイズ, by default None

  • xlabel (str, optional) – x軸のラベル, by default None

  • ylabel (str, optional) – y軸のラベル, by default None

  • title (str, optional) – タイトル, by default None

  • interpolation (str, optional) – 用いる補間方法, by default ‘bilinear’

  • dpi (int, optional) – 解像度(figsizeが指定された場合は無視される), by default 10

Returns:

プロットしたimageデータ(保存した場合None)

Return type:

AxesImage or None

emout.plot.basic_plot.plot_2d_vector(x_data2d, y_data2d, mesh=None, savefilename=None, scale=1, scaler='standard', skip=1, easy_to_read=True, figsize=None, xlabel=None, ylabel=None, title=None, dpi=10, cmap=None, **kwargs)[source]

2次元ベクトル図をプロットする.

Parameters:
  • x_data2d (numpy.ndarray) – 2次元データ

  • y_data2d (numpy.ndarray) – 2次元データ

  • mesh ((numpy.ndarray, numpy.ndarray), optional) – メッシュ, by default None

  • savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None

  • color (str) – ベクトルの色, by default None

  • scale (float) – ベクトルの大きさ係数(最終的な大きさにこの値を掛ける), by default 1

  • skip (int) – プロットするデータ間隔, by default 1

  • easy_to_read (bool) – ベクトルを見やすい大きさにスケーリングするならTrue, by default True

  • figsize ((float, float), optional) – 図のサイズ, by default None

  • xlabel (str, optional) – x軸のラベル, by default None

  • ylabel (str, optional) – y軸のラベル, by default None

  • title (str, optional) – タイトル, by default None

  • interpolation (str, optional) – 用いる補間方法, by default ‘bilinear’

  • dpi (int, optional) – 解像度(figsizeが指定された場合は無視される), by default 10

Returns:

プロットしたimageデータ(保存した場合None)

Return type:

AxesImage or None

emout.plot.basic_plot.plot_2dmap(data2d, mesh=None, savefilename=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>, mask_color='gray', vmin=None, vmax=None, figsize=None, xlabel=None, ylabel=None, title=None, interpolation='bilinear', dpi=10, colorbar_label='', cbargs={}, add_colorbar=True, **kwargs)[source]

2次元カラーマップをプロットする.

Parameters:
  • data2d (numpy.ndarray) – 2次元データ

  • mesh ((numpy.ndarray, numpy.ndarray), optional) – メッシュ, by default None

  • savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None

  • cmap (matplotlib.Colormap or str or None, optional) – カラーマップ, by default cm.coolwarm

  • mask_color (str) – マスクされた位置の色, by default ‘gray’

  • vmin (float, optional) – 最小値, by default None

  • vmax (float, optional) – 最大値, by default None

  • figsize ((float, float), optional) – 図のサイズ, by default None

  • xlabel (str, optional) – x軸のラベル, by default None

  • ylabel (str, optional) – y軸のラベル, by default None

  • title (str, optional) – タイトル, by default None

  • interpolation (str, optional) – 用いる補間方法, by default ‘bilinear’

  • dpi (int, optional) – 解像度(figsizeが指定された場合は無視される), by default 10

  • add_colorbar (bool, optional) – カラーバーを追加する場合True, by default True

Returns:

プロットしたimageデータ(保存した場合None)

Return type:

AxesImage or None

emout.plot.basic_plot.plot_3d_quiver(x_data3d, y_data3d, z_data3d, ax3d=None, mesh=None, savefilename=None, scale=1, scaler='standard', skip=1, easy_to_read=True, figsize=None, xlabel=None, ylabel=None, title=None, dpi=10, cmap=None, **kwargs)[source]

2次元ベクトル図をプロットする.

Parameters:
  • x_data2d (numpy.ndarray) – 2次元データ

  • y_data2d (numpy.ndarray) – 2次元データ

  • mesh ((numpy.ndarray, numpy.ndarray), optional) – メッシュ, by default None

  • savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None

  • color (str) – ベクトルの色, by default None

  • scale (float) – ベクトルの大きさ係数(最終的な大きさにこの値を掛ける), by default 1

  • skip (int) – プロットするデータ間隔, by default 1

  • easy_to_read (bool) – ベクトルを見やすい大きさにスケーリングするならTrue, by default True

  • figsize ((float, float), optional) – 図のサイズ, by default None

  • xlabel (str, optional) – x軸のラベル, by default None

  • ylabel (str, optional) – y軸のラベル, by default None

  • title (str, optional) – タイトル, by default None

  • interpolation (str, optional) – 用いる補間方法, by default ‘bilinear’

  • dpi (int, optional) – 解像度(figsizeが指定された場合は無視される), by default 10

Returns:

プロットしたimageデータ(保存した場合None)

Return type:

AxesImage or None

emout.plot.basic_plot.plot_line(data1d, x=None, savefilename=None, vmin=None, vmax=None, figsize=None, xlabel=None, ylabel=None, label=None, title=None, **kwargs)[source]

1次元データをプロットする.

Parameters:
  • data1d (array-like or scalar) – プロットする1次元データ

  • x (array-like or scalar) – 横軸となる1次元データ, by default None

  • savefilename (str, optional) – 保存するファイル名, by default None

  • vmin (float, optional) – 最小値, by default None

  • vmax (float, optional) – 最大値, by default None

  • figsize ((float, float), optional) – 図のサイズ, by default None

  • xlabel (str, optional) – 横軸のラベル, by default None

  • ylabel (str, optional) – 縦軸のラベル, by default None

  • label (str, optional) – ラベル, by default None

  • title (str, optional) – タイトル, by default None

Returns:

プロットデータを表す線オブジェクト(保存した場合None)

Return type:

Line2D or None

emout.plot.basic_plot.plot_surface(x, y, z, value, ax3d=None, add_colorbar=False, savefilename=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>, mask_color='gray', vmin=None, vmax=None, figsize=None, xlabel=None, ylabel=None, zlabel=None, title=None, ninterp=1, function='linear', dpi=10, colorbar_label='', **kwargs)[source]

3次元表面プロットをする.

Parameters:
  • x ((numpy.ndarray, numpy.ndarray), optional) – x座標のメッシュ

  • y ((numpy.ndarray, numpy.ndarray), optional) – y座標のメッシュ

  • z ((numpy.ndarray, numpy.ndarray), optional) – z座標のメッシュ

  • val ((numpy.ndarray, numpy.ndarray), optional) – 値のメッシュ

  • ax3d (Axes3D) – Axes3Dオブジェクト, by default None

  • savefilename (str, optional) – 保存するファイル名(Noneの場合保存しない), by default None

  • cmap (matplotlib.Colormap or str or None, optional) – カラーマップ, by default cm.coolwarm

  • vmin (float, optional) – 最小値, by default None

  • vmax (float, optional) – 最大値, by default None

  • figsize ((float, float), optional) – 図のサイズ, by default None

  • xlabel (str, optional) – x軸のラベル, by default None

  • ylabel (str, optional) – y軸のラベル, by default None

  • zlabel (str, optional) – z軸のラベル, by default None

  • title (str, optional) – タイトル, by default None

  • dpi (int, optional) – 解像度(figsizeが指定された場合は無視される), by default 10

Returns:

プロットしたimageデータ(保存した場合None)

Return type:

AxesImage or None

emout.plot.extra_plot module

emout.plot.extra_plot.plot_hole_line(inp_or_data, unit=None, use_si=True, offsets=(0, 0), axis='xz', color='black', linewidth=None, fix_lims=True)[source]
emout.plot.extra_plot.plot_line_of_hole_half(inp, off, unit)[source]
emout.plot.extra_plot.plot_surface_with_hole(data_xyz, inp, add_colorbar=True, show=False, vrange='minmax', **kwargs)[source]
emout.plot.extra_plot.plot_surface_with_hole_half(data_xyz, inp, off=10, add_colorbar=True, show=False, vrange='minmax', **kwargs)[source]

emout.plot.plot_cross_sections module

emout.plot.plot_cross_sections.plot_cross_sections(data, axis='z', coord=0.0, ax=None, use_si=True, **kwargs)[source]

Plot boundaries (spheres, flat surfaces, rectangle holes) sliced by plane axis=coord.

Parameters:
  • data (object) – Must have inp.boundary_type, inp.boundary_types, and relevant params.

  • axis ({'x','y','z'}) – Normal of slicing plane.

  • coord (float) – Coordinate along axis of the slicing plane.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on.

  • kwargs – Passed to individual plot functions for styling.

Returns:

ax

Return type:

matplotlib.axes.Axes

Module contents