galaximview.funcsplots module¶
- galaximview.funcsplots.plot_1d(xarr, yarr, xlimit_pl=None, ylimit_pl=None, xlab=None, ylab=None, leglab=None, funcofy=<function identity_function>, linestyle='-', linewidth=1, color=None)[source]¶
Simple 1D plot of funcofy(yarr) as a function of xarr.
- Parameters
xarr (ndarray) – (N,) array such that funcofy(yarr) is plotted as a function of xarr.
yarr (ndarray) – (N,) array such that funcofy(yarr) is plotted as a function of xarr.
xlimit_pl ((float, float) or None, default = None) – x axis limits used for plot. Defaults to None (auto-adjusts).
ylimit_pl ((float, float) or None, default = None) – y axis limits used for plot. Defaults to None (auto-adjusts).
xlab (str, optional) – x axis label.
ylab (str, optional) – x axis label.
leglab (str, optional) – Line label.
funcofy (ufunc) – Function such that funcofy(yarr) is plotted as a function of xarr. Defaults to identity_function.
linestyle (matplotlib linestyle, optional) – Matplotlib linestyle for plot. Defaults to ‘-‘ (solid line).matplotlib linestyle
linewidth (matplotlib linewidth, optional) – Matplotlib linewidth for plot. Defaults to 1 (normal width).
color (matplotlib color) – Matplotlib color of dots. Defaults to None (thus follows matplotlib colors order).
- galaximview.funcsplots.plot_3d(xarr, yarr, zarr, xlimit_pl, ylimit_pl, zlimit_pl, xlab=None, ylab=None, zlab=None, leglab=None, linestyle='-', ax=None, color=None)[source]¶
Plots dots of coordinates xarr, yarr, zarr in a box of edge 2 * rmax.
- Parameters
xarr (ndarray) – (N,) array for corresponding axis.
yarr (ndarray) – (N,) array for corresponding axis.
zarr (ndarray) – (N,) array for corresponding axis.
xlimit_pl ((float, float)) – x axis limits used for plot.
ylimit_pl ((float, float)) – x axis limits used for plot.
zlimit_pl ((float, float)) – x axis limits used for plot.
xlab (str, optional) – Axis label.
ylab (str, optional) – Axis label.
zlab (str, optional) – Axis label.
leglab (str, optional) – Matplotlib legend for 3D dots. Defaults to None (no legend).
linestyle (matplotlib linestyle, optional) – Matplotlib linestyle for plot. Defaults to ‘-‘ (solid line).matplotlib linestyle
color (matplotlib color) – Matplotlib color of dots. Defaults to None (thus follows matplotlib colors order).
ax (matplotlib axis or None, optional) – Specific matplotlib axis to plot on. Defaults to None.
- galaximview.funcsplots.plot_hist2d(hm2d, edy, edx, funcforpl=<ufunc 'log10'>, vmin_plot=None, vmax_plot=None, add_eps_in_plot=False, cmap=None, show_color_bar=True, fig=None, cb_loc=None, xlab=None, ylab=None, cblab=None, interpolation='none')[source]¶
Plots 2D histogram hm2d of edges edy and ex. Can plot only images with pixels of fixed dx and dy.
- Parameters
hm2d (ndarray) – (Ny, Nx) 2D histogram to plot
edy (ndarray) – (Ny+1,) y edges
edx (ndarray) – (Nx+1,) x edges
funcforpl (ufunc, default = np.log10) – Function applied to hm2d.
vmin_plot (float or None, default = None) – Minimum value of funcforpl(hm2d) to be plotted. If None, set by
vmin_vmax_pl()
.vmax_plot (float or None, default = None) – Maximum value of funcforpl(hm2d) to be plotted. If None, set by
vmin_vmax_pl()
.add_eps_in_plot (bool, default = False) – Add machine precision epsilon in plots (for aesthetical purpose).
cmap (matplotlib color map or None) – Matplotlib color map. Defaults to None and is in this case the default matplotlib color map.
show_color_bar (bool, default = True) – True if one wants to show the color bar. Defaults to True.
fig (matplotlib figure, optional) – Figure to plot color bar on if cb_loc is not None.
cb_loc (matplotlib axis, optional) – Matplotlib axis to add color bar to. Defaults to None and in this case, add it to current axis.
xlab (str, optional) – x axis label.
ylab (str, optional) – x axis label.
cblab (str, optional) – Color bar label. Defaults to None (no label).
interpolation (str, optional) – Type of matplotlib interpolation. Defaults to ‘none’.
- Returns
plt.imshow object
- Return type
object
- galaximview.funcsplots.plot_hist2d_with_pdfs(hm2dxy, hmdx, hmdy, edx, edy, funcforpl=<ufunc 'log10'>, funcforplx=<ufunc 'log10'>, funcforply=<ufunc 'log10'>, vmin_plot=None, vmax_plot=None, cmap=None, show_color_bar=False, fig=None, xlab=None, ylab=None, cblab=None, strtit=None, ax=None)[source]¶
Plots 2D-histogram with marginal distributions.
- Parameters
hm2dxy (ndarray) – (Ny, Nx) 2D histogram to plot.
hmdx (ndarray) – (Nx,) 1D marginal histogram for x axis.
hmdy (ndarray) – (Ny,) 1D marginal histogram for y axis.
edx (ndarray) – (Nx+1,) x edges
edy (ndarray) – (Ny+1,) y edges
funcforpl (ufunc, default = np.log10) – Function applied to hm2dxy. Defaults to np.log10.
funcforplx (ufunc) – Function applied to hmdx. Defaults to np.log10.
funcforply (ufunc) – Function applied to hmdy. Defaults to np.log10.
vmin_plot (float or None, default = None) – Minimum value of funcforpl(hm2dxy) to be plotted. Defaults to None and is in this case set by the function vmin_vmax_pl.
vmax_plot (float or None, default = None) – Maximum value of funcforpl(hm2dxy) to be plotted. Defaults to None and is in this case set by the function vmin_vmax_pl.
cmap (matplotlib color map or None) – Matplotlib color map. Defaults to None and is in this case the default matplotlib color map.
show_color_bar (bool, default = True) – True if one wants to show the color bar. Defaults to True.
fig (matplotlib figure.) – Figure to plot on. Defaults to None and in this case, plots on current figure or, if none, on new figure.
xlab (str, optional) – x axis label.
ylab (str, optional) – x axis label.
cblab (str or None, optional) – Color bar label. Defaults to None (no label).
strtit (strtit: str or None, optional) – Title of figure. Defaults to None.
ax (matplotlib axis aobject) – Matplotlib axis. Defaults to None.
- Returns
3 matplotlib axes
- Return type
3 matplotlib axis objects
- galaximview.funcsplots.vmin_vmax_pl(arr, funcforpl)[source]¶
Computes minimum and maximum values for plt.imshow(funcforpl(arr)).
- Parameters
arr (ndarray) – Array to be plotted.
funcforpl (ufunc) – Function applied to array.
- Returns
Minimum and maximum values to be used by plt.imshow(funcforpl(arr)). 7
- Return type
float, float