vis.plotter#

Contains the classes and functions for single-cell plots.

Functions

error_bar_plot(idx_name, pmf_diff, params[, ...])

Bar plot of errors.

error_bar_split_plot(errs, lbls, bs, ts, ...)

Function to generate error bar plots with a split in the middle, e.g., when space in limited on a presentation slide or poster.

error_bar_abs_plot(errs, lbls[, fs, title, ...])

Classes

fig_obj(fig, nhi, nhj[, cbar, set_label])

A figure object class to plot physical and spectral panels.

class vis.plotter.fig_obj(fig, nhi, nhj, cbar=True, set_label=True)#

A figure object class to plot physical and spectral panels.

__init__(fig, nhi, nhj, cbar=True, set_label=True)#

Initialises the figure object and the methods fill the axes.

Parameters#

figmatplotlib.figure.Figure instance

matplotlib figure

nhiint

number of harmonics in the first horizontal direction

nhjint

number of harmonics in the second horizontal direction

cbarbool, optional

user-defined colorbar, by default True

set_labelbool, optional

toggle axis labels, by default True

phys_panel(axs, data, title='', extent=None, xlabel='', ylabel='', v_extent=None)#

Plots a physical depiction of the input data.

Parameters#

axsplt.Axes

matplotlib figure axis

dataarray-like

2D image data

titlestr, optional

panel title, by default “”

extentlist, optional

[x0,x1,y0,y1], by default “”

xlabelstr, optional

x-axis label, by default “”

ylabelstr, optional

y-axis label, by default “”

v_extentlist, optional

[h0,h1]; vertical extent of the data, by default None

Returns#

plt.Axes

matplotlib figure axis

freq_panel(axs, ampls, nhi=None, nhj=None, title='Power spectrum', v_extent=None, show_edge=False)#

Plots the spectrum in a dense truncated spectral space.

Parameters#

axsplt.Axes

matplotlib figure axis

amplsarray-like

2D (abs.) spectral data

nhiint, optional

number of harmonics in the first horizontal direction, by default None

nhj_type_, optional

number of harmonics in the second horizontal direction, by default None

titlestr, optional

user-defined panel title, by default “Power spectrum”

v_extent_type_, optional

[h0,h1]; vertical extent of the data, by default None

Returns#

plt.Axes

matplotlib figure axis

fft_freq_panel(axs, ampls, kks, lls, title='FFT power spectrum', interval=20, typ='imag')#

Plots the spectrum in the full spectral space.

Parameters#

axsplt.Axes

matplotlib figure axis

amplsarray-like

2D (abs.) spectral data

kkslist

list of first horizontal wavenumbers

llslist

list of second horizontal wavenumbers

Returns#

plt.Axes

matplotlib figure axis

vis.plotter.error_bar_plot(idx_name, pmf_diff, params, comparison=None, title='', gen_title=False, output_fig=False, fn='../output/error_plot.pdf', ylim=[-100, 100], fs=(10.0, 6.0), ylabel='', fontsize=8)#

Bar plot of errors.

Parameters#

idx_namelist

labels of the error plots, e.g., cell index

pmf_difflist

list containing the errors. Same size as idx_name.

paramssrc.var.params

user parameter class

comparisonlist, optional

a second error list to be compared to pmf_diff. Same size as pmf_diff, by default None

titlestr, optional

user-defined panel title, by default “”

gen_titlebool, optional

automatically generate panel title from params, by default False

output_figbool, optional

toggle writing figure output, by default False

fnstr, optional

path to write output figure, by default “../output/error_plot.pdf”

ylimlist, optional

extent of the error bar plot, by default [-100,100]

fstuple, optional

figure size, by default (10.0,6.0)

ylabelstr, optional

y-axis label, by default “”

fontsizeint, optional

by default 8

vis.plotter.error_bar_split_plot(errs, lbls, bs, ts, ts_ticks, fs=(3.5, 3.5), title='', output_fig=False, fn='output/errors.pdf')#

Function to generate error bar plots with a split in the middle, e.g., when space in limited on a presentation slide or poster.

vis.plotter.error_bar_abs_plot(errs, lbls, fs=(3.5, 3.5), title='', output_fig=False, fn='output/errors.pdf', color=None, ylims=None, fontsize=10)#
class vis.plotter.plot_3d(cell, ele=5, azi=230, cpad=0.01)#

Helper class for 3D plots

__init__(cell, ele=5, azi=230, cpad=0.01)#

Parameters#

cellsrc.var.topo_cell

instance of a cell object

eleint, optional

elevation angle, by default 5

aziint, optional

azimuthal angle, by default 230

cpadfloat, optional

colour bar padding, by default 0.01

plot(Z, output_fig=True, output_fn='plot_3D', lbls=None, fs=(10, 10))#

Does the plotting

Parameters#

Zarray-like

2D elevation array

output_figbool, optional

toggles output of figure, by default True

output_fnstr, optional

output filnemae, by default “plot_3D”

lblslist, optional

list of axis labels containing [x_label, y_label, z_label], by default None

fstuple, optional

figure size, by default (10,10)