K3dMesh#
- class discretisedfield.plotting.K3dMesh(mesh)#
Methods
k3d
plot.__dir__
Default dir() implementation.
__eq__
Return self==value.
__repr__
Return repr(self).
k3d
subregions plot.- __call__(*, plot=None, color=[5010096, 14517330], multiplier=None, **kwargs)#
k3d
plot.If
plot
is not passed,k3d.Plot
object is created automatically. The color of the region and the discretisation cell can be specified usingcolor
length-2 tuple, where the first element is the colour of the region and the second element is the colour of the discretisation cell.It is often the case that the object size is either small (e.g. on a nanoscale) or very large (e.g. in units of kilometers). Accordingly,
multiplier
can be passed as \(10^{n}\), where \(n\) is a multiple of 3 (…, -6, -3, 0, 3, 6,…). According to that value, the axes will be scaled and appropriate units shown. For instance, ifmultiplier=1e-9
is passed, all axes will be divided by \(1\,\text{nm}\) and \(\text{nm}\) units will be used as axis labels. Ifmultiplier
is not passed, the best one is calculated internally.This method is based on
k3d.voxels
, so any keyword arguments accepted by it can be passed (e.g.wireframe
).- Parameters:
plot (k3d.Plot, optional) – Plot to which the plot is added. Defaults to
None
- plot is created internally.color ((2,) array_like) – Colour of the region and the discretisation cell. Defaults to the default color palette.
multiplier (numbers.Real, optional) – Axes multiplier. Defaults to
None
.
Examples
Visualising the mesh using
k3d
.
>>> import discretisedfield as df >>> p1 = (0, 0, 0) >>> p2 = (100, 100, 100) >>> n = (10, 10, 10) >>> mesh = df.Mesh(p1=p1, p2=p2, n=n) ... >>> mesh.k3d() Plot(...)
- subregions(*, plot=None, color=[5010096, 14517330, 5613672, 12865106, 8483507, 9664608, 14322627, 9211020, 13416820, 6600141], multiplier=None, **kwargs)#
k3d
subregions plot.If
plot
is not passed,k3d.Plot
object is created automatically. The color of the subregions can be specified usingcolor
.It is often the case that the object size is either small (e.g. on a nanoscale) or very large (e.g. in units of kilometers). Accordingly,
multiplier
can be passed as \(10^{n}\), where \(n\) is a multiple of 3 (…, -6, -3, 0, 3, 6,…). According to that value, the axes will be scaled and appropriate units shown. For instance, ifmultiplier=1e-9
is passed, all axes will be divided by \(1\,\text{nm}\) and \(\text{nm}\) units will be used as axis labels. Ifmultiplier
is not passed, the best one is calculated internally.This method is based on
k3d.voxels
, so any keyword arguments accepted by it can be passed (e.g.wireframe
).- Parameters:
plot (k3d.Plot, optional) – Plot to which the plot is added. Defaults to
None
- plot is created internally.color (array_like) – Colour of the subregions. Defaults to the default color palette.
multiplier (numbers.Real, optional) – Axes multiplier. Defaults to
None
.
Examples
Visualising subregions using
k3d
.
>>> import discretisedfield as df >>> p1 = (0, 0, 0) >>> p2 = (100, 100, 100) >>> n = (10, 10, 10) >>> subregions = {'r1': df.Region(p1=(0, 0, 0), p2=(50, 100, 100)), ... 'r2': df.Region(p1=(50, 0, 0), p2=(100, 100, 100))} >>> mesh = df.Mesh(p1=p1, p2=p2, n=n, subregions=subregions) ... >>> mesh.k3d.subregions() Plot(...)