cigvis.mpl2dplot module#

Functions for plotting 2D data using matplotlib#

Some 2D plotting tools (based on matplotlib). Since matplotlib is already very convenient and provides more freedom, the implementations in this package are very simple and are only for reference.

In the future, we will implement some demos that have more geophysical features.

cigvis.mpl2dplot.annotate_args(x, y, text, w=1, h=1, **kwargs)#
cigvis.mpl2dplot.discrete_cbar(im, ticks_label=None, remove_trans=False)#
cigvis.mpl2dplot.fg_image_args(img, cmap='jet', clim=None, alpha=None, interpolation='bicubic', show_cbar=True, **kwargs)#
cigvis.mpl2dplot.flattened_view(volume, axis_scales=[1, 1, 1])#

Plot a flattened view of the volume

Parameters#

volumenp.ndarray

volume, shape=(n1, n2, n3)

cigvis.mpl2dplot.line_args(x, y, color=None, alpha=None, lw=None, label=None, marker=None, linestyle=None, markersize=None, **kwargs)#
cigvis.mpl2dplot.marker_args(x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, zorder=2, **kwargs)#
cigvis.mpl2dplot.plot2d()#

Parameters#

imgarray-like

background img, shape=(n1, n2)

fgDict

foreground, it can be a combination of ‘img’, ‘line’, ‘marker’, ‘annotate’

cmapstr or Colormap

cmap for background image (‘img’)

climList

[vmin, vmax] for background

interpolationstr

interpolation method for background

figsizeTuple

figure size

titlestr

title string

xlabelstr

label for x axis

ylabelstr

label for y axis

aspectstr or float

can be ‘equal’ (default), ‘auto’ or a float number, if is a float number v, it means H / W = w

axisoffbool

turn off axis

xsampleList

sampling information for x axis, it can be [x_start, x_step]. x_start is the start of axis, x_step is interval of x axis,

ysampleList

sampling information for y axis, it can be [y_start, y_step]. y_start is the start of axis, y_step is interval of y axis,

cbarstr

If is not None, will show a colorbar at the right, cabr is the label. If cbar=’’, will ignore colorbar label

discretebool

discrete colorbar

tick_labelsList

If discrete, set a label for each value

remove_transbool

If alpha of the value is 0, colorbar will remove the value

show_legendbool

show legend if fg contains ‘line’

font_sizefloat

each font size

savestr

save name

showbool

call plt.show()

axAny

parent axes, used when plt.subplots()