plotting module

Classes:

FlinnPlot(*args, **kwargs)

Represents the Ramsay deformation plot.

HsuPlot(*args, **kwargs)

Represents the Hsu fabric plot.

RamsayPlot(*args, **kwargs)

Represents the Ramsay deformation plot.

RosePlot(**kwargs)

RosePlot class for rose histogram plotting.

StereoGrid(**kwargs)

The class to store values with associated uniformly positions.

StereoNet(**kwargs)

Plot features on stereographic projection

VollmerPlot(*args, **kwargs)

Represents the triangular fabric plot (Vollmer, 1989).

Functions:

quicknet(*args, **kwargs)

Function to quickly show or save StereoNet from args

class apsg.plotting.FlinnPlot(*args, **kwargs)

Bases: FabricPlot

Represents the Ramsay deformation plot.

path(*args, **kwargs)

Plot EllipsoidSet as path

point(*args, **kwargs)

Plot Ellipsoid as point

class apsg.plotting.HsuPlot(*args, **kwargs)

Bases: FabricPlot

Represents the Hsu fabric plot.

path(*args, **kwargs)

Plot EllipsoidSet as path

point(*args, **kwargs)

Plot Ellipsoid as point

class apsg.plotting.RamsayPlot(*args, **kwargs)

Bases: FabricPlot

Represents the Ramsay deformation plot.

path(*args, **kwargs)

Plot EllipsoidSet as path

point(*args, **kwargs)

Plot ellipsoid as point

class apsg.plotting.RosePlot(**kwargs)

Bases: object

RosePlot class for rose histogram plotting.

Keyword Arguments:
  • title (str) – figure title. Default None

  • bins (int) – Number of bins. Default 36

  • axial (bool) – Directional data are axial. Defaut True

  • density (bool) – Use density instead of counts. Default False

  • pdf (bool) – Plot Von Mises density function instead histogram. Default False

  • pdf_res (int) – Resolution of pdf. Default 901

  • kappa (float) – Shape parameter of Von Mises pdf. Default 250

  • scaled (bool) – Bins scaled by area instead value. Default False

  • ticks (bool) – show ticks. Default True

  • grid (bool) – show grid lines. Default False

  • grid_kw (dict) – Dict passed to Axes.grid. Default {}

  • plot. (Other keyword arguments are passed to matplotlib) –

Examples

>>> v = vec2set.random_vonmises(position=120)
>>> p = RosePlot(grid=False)
>>> p.pdf(v)
>>> p.bar(v, fc='none', ec='k', lw=1)
>>> p.muci(v)
>>> p.show()
bar(*args, **kwargs)

Plot rose histogram of angles

clear()

Clear plot

classmethod from_json(json_dict)

Create rose plot from JSON dict

classmethod load(filename)

Load stereonet from pickle file

Parameters:

filename (str) – name of picke file

muci(*args, **kwargs)

Plot circular mean with confidence interval

pdf(*args, **kwargs)

Plot rose histogram of angles

render2fig(fig)

Plot stereonet to already existing figure or subfigure

Parameters:

fig (Figure) – A mtplotlib Figure artist

save(filename)

Save stereonet to pickle file

Parameters:

filename (str) – name of picke file

savefig(filename='roseplot.png', **kwargs)

Save rose plot figure to graphics file

Keyword Arguments:

filename (str) – filename

All others kwargs are passed to matplotlib Figure.savefig

show()

Show rose plot

to_json()

Return rose plot as JSON dict

class apsg.plotting.StereoGrid(**kwargs)

Bases: object

The class to store values with associated uniformly positions.

StereoGrid is used to calculate continous functions on sphere e.g. density distribution.

Keyword Arguments:
  • kind (str) – Equal area (“equal-area”, “schmidt” or “earea”) or equal angle (“equal-angle”, “wulff” or “eangle”) projection. Default is “equal-area”

  • hemisphere (str) – “lower” or “upper”. Default is “lower”

  • overlay_position (tuple or Pair) – Position of overlay X, Y, Z given by Pair. X is direction of linear element, Z is normal to planar. Default is (0, 0, 0, 0)

  • rotate_data (bool) – Whether plotted data should be rotated together with overlay. Default False

  • minor_ticks (None or float) – Default None

  • major_ticks (None or float) – Default None

  • overlay (bool) – Whether to show overlay. Default is True

  • overlay_step (float) – Grid step of overlay. Default 15

  • overlay_resolution (float) – Resolution of overlay. Default 181

  • clip_pole (float) – Clipped cone around poles. Default 15

  • grid_type (str) – Type of contouring grid “gss” or “sfs”. Default “gss”

  • grid_n (int) – Number of counting points in grid. Default 3000

Note: Euclidean norms are used as weights. Normalize data if you dont want to use weigths.

angmech(faults, **kwargs)

Implementation of Angelier-Mechler dihedra method

Parameters:

faultsFaultSet of data

Kwargs:

method: ‘probability’ or ‘classic’. Classic method assigns +/-1 to individual positions, while ‘probability’ returns maximum likelihood estimate. Other kwargs are passed to contourf

apply_func(func, *args, **kwargs)

Calculate values of user-defined function on sphere.

Function must accept Vector3 like (or 3 elements array) as first argument and return scalar value.

Parameters:
  • func (function) – function used to calculate values

  • *args – passed to function func as args

  • **kwargs – passed to function func as kwargs

calculate_density(features, **kwargs)

Calculate density distribution of vectors from FeatureSet object.

The modified Kamb contouring technique with exponential smoothing is used.

Parameters:
  • sigma (float) – if none sigma is calculated automatically. Default None

  • sigmanorm (bool) – If True counting is normalized to sigma multiples. Default True

  • trimzero – if True, zero contour is not drawn. Default True

contour(*args, **kwargs)

Draw contour lines of values using tricontour.

Keyword Arguments:
  • levels (int or list) – number or values of contours. Default 6

  • cmap – matplotlib colormap used for filled contours. Default “Greys”

  • colorbar (bool) – Show colorbar. Default False

  • alpha (float) – transparency. Default None

  • antialiased (bool) – Default True

  • linewidths (float) – contour lines width

  • linestyles (str) – contour lines style

contourf(*args, **kwargs)

Draw filled contours of values using tricontourf.

Keyword Arguments:
  • levels (int or list) – number or values of contours. Default 6

  • cmap – matplotlib colormap used for filled contours. Default “Greys”

  • colorbar (bool) – Show colorbar. Default False

  • alpha (float) – transparency. Default None

  • antialiased (bool) – Default True

density_lookup(v)

Calculate density distribution value at position given by vector

Note: you need to calculate density before using this method

Parameters:

v – Vector3 like object

Keyword Arguments:

p (int) – power. Default 2

max()

Returns maximum value of the grid

max_at()

Returns position of maximum value of the grid as Lineation

min()

Returns minimum value of the grid

min_at()

Returns position of minimum value of the grid as Lineation

plotcountgrid(**kwargs)

Show counting grid.

class apsg.plotting.StereoNet(**kwargs)

Bases: object

Plot features on stereographic projection

Keyword Arguments:
  • title (str) – figure title. Default None.

  • tight_layout (bool) – Matplotlib figure tight_layout. Default False

  • kind (str) – Equal area (“equal-area”, “schmidt” or “earea”) or equal angle (“equal-angle”, “wulff” or “eangle”) projection. Default is “equal-area”

  • hemisphere (str) – “lower” or “upper”. Default is “lower”

  • overlay_position (tuple or Pair) – Position of overlay X, Y, Z given by Pair. X is direction of linear element, Z is normal to planar. Default is (0, 0, 0, 0)

  • rotate_data (bool) – Whether plotted data should be rotated together with overlay. Default False

  • minor_ticks (None or float) – Default None

  • major_ticks (None or float) – Default None

  • overlay (bool) – Whether to show overlay. Default is True

  • overlay_step (float) – Grid step of overlay. Default 15

  • overlay_resolution (float) – Resolution of overlay. Default 181

  • clip_pole (float) – Clipped cone around poles. Default 15

  • grid_type (str) – Type of contouring grid “gss” or “sfs”. Default “gss”

  • grid_n (int) – Number of counting points in grid. Default 3000

Examples

>>> l = linset.random_fisher(position=lin(120, 40))
>>> s = StereoNet(title="Random linear features")
>>> s.contour(l)
>>> s.line(l)
>>> s.show()
arc(*args, **kwargs)

Plot arc bewtween two vectors along great circle(s)

arrow(*args, **kwargs)

Plot arrows at position of first argument and oriented in direction of second

clear()

Clear plot

cone(*args, **kwargs)

Plot small circle(s) with given angle(s)

contour(*args, **kwargs)

Plot filled contours using modified Kamb contouring technique with exponential smoothing

Keyword Arguments:
  • levels (int or list) – number or values of contours. Default 6

  • cmap – matplotlib colormap used for filled contours. Default “Greys”

  • colorbar (bool) – Show colorbar. Default False

  • alpha (float) – transparency. Default None

  • antialiased (bool) – Default True

  • sigma (float) – If None it is automatically calculated

  • sigmanorm (bool) – If True scaled counts are normalized by sigma. Default True

  • trimzero (bool) – Remove values equal to 0. Default True

  • clines (bool) – Show contour lines instead filled contours. Default False

  • linewidths (float) – contour lines width

  • linestyles (str) – contour lines style

  • show_data (bool) – Show data as points. Default False

  • data_kwargs (dict) – arguments passed to point factory

fault(*args, **kwargs)

Plot fault feature(s) as great circle and point

format_coord(x, y)

Format stereonet coordinates

classmethod from_json(json_dict)

Create stereonet from JSON dict

great_circle(*args, **kwargs)

Plot planar feature(s) as great circle(s)

hoeppner(*args, **kwargs)

Plot a fault-and-striae as in tangent lineation plot - Hoeppner plot.

line(*args, **kwargs)

Plot linear feature(s) as point(s)

classmethod load(filename)

Load stereonet from pickle file

Parameters:

filename (str) – name of picke file

pair(*args, **kwargs)

Plot pair feature(s) as great circle and point

pole(*args, **kwargs)

Plot pole of planar feature(s) as point(s)

render2fig(fig)

Plot stereonet to already existing figure or subfigure

Parameters:

fig (Figure) – A mtplotlib Figure artist

save(filename)

Save stereonet to pickle file

Parameters:

filename (str) – name of picke file

savefig(filename='stereonet.png', **kwargs)

Save stereonet figure to graphics file

Keyword Arguments:

filename (str) – filename

All others kwargs are passed to matplotlib Figure.savefig

scatter(*args, **kwargs)

Plot vector-like feature(s) as point(s) using scatter

show()

Show stereonet

to_json()

Return stereonet as JSON dict

vector(*args, **kwargs)

Plot vector feature(s) as point(s), filled on lower and open on upper hemisphere.

class apsg.plotting.VollmerPlot(*args, **kwargs)

Bases: FabricPlot

Represents the triangular fabric plot (Vollmer, 1989).

Keyword Arguments:
  • title (str) – figure title. Default None.

  • ticks (bool) – Show ticks. Default True

  • n_ticks (int) – Number of ticks. Default 10

  • tick_size (float) – Size of ticks. Default 0.2

  • margin (float) – Size of margin. Default 0.05

  • grid (bool) – Show grid. Default is True

  • grid_color (str) – Matplotlib color of the grid. Default “k”

  • grid_style (str) – Matplotlib style of the grid. Default “:”

Examples

>>> l = linset.random_fisher(position=lin(120, 40))
>>> ot = l.ortensor()
>>> s = VollmerPlot(title="Point distribution")
>>> s.point(ot)
>>> s.show()
path(*args, **kwargs)

Plot EllipsoidSet as path

point(*args, **kwargs)

Plot ellipsoid as point

apsg.plotting.quicknet(*args, **kwargs)

Function to quickly show or save StereoNet from args

Parameters:

args – object(s) to be plotted. Instaces of Vector3, Foliation, Lineation, Pair, Fault, Cone, Vector3Set, FoliationSet, LineationSet, PairSet or FaultSet.

Keyword Arguments:
  • savefig (bool) – True to save figure. Default False

  • filename (str) – filename for figure. Default stereonet.png

  • savefig_kwargs (dict) – dict passed to plt.savefig

  • fol_as_pole (bool) – True to plot planar features as poles, False for plotting as great circle. Default True

Example

>>> l = linset.random_fisher(position=lin(120, 50))
>>> f = folset.random_fisher(position=lin(300, 40))
>>> quicknet(f, l, fol_as_pole=False)