fatiando.vis.myv
)¶Wrappers for calls to Mayavi2’s mlab module for plotting
fatiando.mesher
objects and automating common tasks.
Warning
This module will be removed in v0.7.
Objects
Misc objects
outline
axes
wall_north
wall_south
wall_east
wall_west
wall_top
wall_bottom
earth
core
continents
meridians
parallels
Helpers
fatiando.vis.myv.
axes
(plot, nlabels=5, extent=None, ranges=None, color=(0, 0, 0), width=2, fmt='%-#.2f')[source]¶Add an Axes module to a Mayavi2 plot or dataset.
Parameters:
Either the plot (as returned by one of the plotting functions of this module) or a TVTK dataset.
Number of labels on the axes
Default if the objects extent.
What will be display in the axes labels. Default is extent
RGB of the color of the axes and text
Line width
Label number format
Returns:
The axes object in the pipeline
fatiando.vis.myv.
continents
(color=(0, 0, 0), linewidth=1, resolution=2, opacity=1, radius=6378137.0)[source]¶Plot the outline of the continents.
Parameters:
RGB color of the lines. Default = black
The width of the continent lines
The data_source.on_ratio parameter that controls the resolution of the continents
The opacity of the lines. Must be between 0 and 1
The radius of the sphere where the continents will be plotted. Defaults to the mean Earth radius
Returns:
The Mayavi surface element of the continents
fatiando.vis.myv.
core
(inner=False, color=(1, 0, 0), opacity=1)[source]¶Draw a sphere representing the Earth’s core.
Parameters:
If True, will use the radius of the inner core, else the outer core.
RGB color of the sphere. Defaults to red.
The opacity of the sphere. Must be between 0 and 1
Returns:
The Mayavi surface element of the sphere
fatiando.vis.myv.
earth
(color=(0.4, 0.5, 1.0), opacity=1)[source]¶Draw a sphere representing the Earth.
Parameters:
RGB color of the sphere. Defaults to ocean blue.
The opacity of the sphere. Must be between 0 and 1
Returns:
The Mayavi surface element of the sphere
fatiando.vis.myv.
figure
(size=None, zdown=True, color=(1, 1, 1))[source]¶Create a default figure in Mayavi with white background
Parameters:
The size of the figure. If None
will use the default size.
If True, will turn the figure upside-down to make the z-axis point down
RGB of the color of the background
Return:
The figure
fatiando.vis.myv.
meridians
(longitudes, color=(0, 0, 0), linewidth=1, opacity=1)[source]¶Draw meridians on the Earth.
Parameters:
The longitudes where the meridians will be drawn.
RGB color of the lines. Defaults to black.
The width of the lines
The opacity of the lines. Must be between 0 and 1
Returns:
The Mayavi surface element of the lines
fatiando.vis.myv.
outline
(extent=None, color=(0, 0, 0), width=2, scale=(1, 1, 1))[source]¶Create a default outline in Mayavi2.
Parameters:
Default if the objects extent.
RGB of the color of the axes and text
Line width
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
Returns:
The outline in the pipeline
fatiando.vis.myv.
parallels
(latitudes, color=(0, 0, 0), linewidth=1, opacity=1)[source]¶Draw parallels on the Earth.
Parameters:
The latitudes where the parallels will be drawn.
RGB color of the lines. Defaults to black.
The width of the lines
The opacity of the lines. Must be between 0 and 1
Returns:
List of the Mayavi surface elements of each line
fatiando.vis.myv.
points
(points, color=(0, 0, 0), size=200.0, opacity=1, spherical=False)[source]¶Plot a series of 3D points.
Note
Still doesn’t plot points with physical properties.
Parameters:
The list of points to plot. Each point is an [x, y, z] list with the x, y, and z coordinates of the point
RGB of the color of the points
The size of the points in meters
Decimal percentage of opacity
If True, will assume the points are in [lon, lat, height] format (in degrees and meters)
Returns:
The Mayavi Glyph object corresponding to the points
fatiando.vis.myv.
polyprisms
(prisms, prop=None, style='surface', opacity=1, edges=True, vmin=None, vmax=None, cmap='blue-red', color=None, linewidth=1, edgecolor=(0, 0, 0), scale=(1, 1, 1))[source]¶Plot a list of 3D polygonal prisms using Mayavi2.
Will not plot a value None in prisms.
Parameters:
fatiando.mesher.PolygonalPrism
The prisms
The physical property of the prisms to use as the color scale. If a prism doesn’t have prop, or if it is None, then it will not be plotted If prop is a vector (like magnetization), will use the intensity (norm).
Either 'surface'
for solid prisms or 'wireframe'
for just the
contour
Decimal percentage of opacity
Wether or not to display the edges of the prisms in black lines. Will
ignore this if style='wireframe'
Min and max values for the color scale. If None will default to the min and max of prop in the prisms.
Color map to use. See the ‘Colors and Legends’ menu on the Mayavi2 GUI for valid color maps.
If not None, then for all prisms to have this RGB color
The width of the lines (edges) of the prisms.
RGB of the color of the edges. If style=’wireframe’, then will be ignored. Use parameter color instead
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
Returns:
the last element on the pipeline
fatiando.vis.myv.
prisms
(prisms, prop=None, style='surface', opacity=1, edges=True, vmin=None, vmax=None, cmap='blue-red', color=None, linewidth=1, edgecolor=(0, 0, 0), scale=(1, 1, 1))[source]¶Plot a list of 3D right rectangular prisms using Mayavi2.
Will not plot a value None in prisms
Parameters:
fatiando.mesher.Prism
The prisms
The physical property of the prisms to use as the color scale. If a prism doesn’t have prop, or if it is None, then it will not be plotted If prop is a vector (like magnetization), will use the intensity (norm).
Either 'surface'
for solid prisms or 'wireframe'
for just the
contour
Decimal percentage of opacity
Wether or not to display the edges of the prisms in black lines. Will
ignore this if style='wireframe'
Min and max values for the color scale. If None will default to the min and max of prop in the prisms.
Color map to use. See the ‘Colors and Legends’ menu on the Mayavi2 GUI for valid color maps.
If not None, then for all prisms to have this RGB color
The width of the lines (edges) of the prisms.
RGB of the color of the edges. If style=’wireframe’, then will be ignored. Use parameter color instead
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
Returns:
the last element on the pipeline
fatiando.vis.myv.
savefig
(fname, magnification=None)[source]¶Save a snapshot the current Mayavi figure to a file.
Parameters:
The name of the file. The format is deduced from the extension.
If not None, then the scaling between the pixels on the screen, and the pixels in the file saved.
fatiando.vis.myv.
show
()[source]¶Show the 3D plot of Mayavi2.
Enters a loop until the window is closed.
fatiando.vis.myv.
tesseroids
(tesseroids, prop=None, style='surface', opacity=1, edges=True, vmin=None, vmax=None, cmap='blue-red', color=None, linewidth=1, edgecolor=(0, 0, 0), scale=(1, 1, 1))[source]¶Plot a list of tesseroids using Mayavi2.
Will not plot a value None in tesseroids
Parameters:
fatiando.mesher.Tesseroid
The tesseroids
The physical property of the tesseroids to use as the color scale. If a tesseroid doesn’t have prop, or if it is None, then it will not be plotted. If prop is a vector (like magnetization), will use the intensity (norm).
Either 'surface'
for solid tesseroids or 'wireframe'
for just
the contour
Decimal percentage of opacity
Wether or not to display the edges of the tesseroids in black lines.
Will ignore this if style='wireframe'
Min and max values for the color scale. If None will default to the min and max of prop.
Color map to use. See the ‘Colors and Legends’ menu on the Mayavi2 GUI for valid color maps.
If not None, then for all tesseroids to have this RGB color
The width of the lines (edges) of the tesseroids.
RGB of the color of the edges. If style=’wireframe’, then will be ignored. Use parameter color instead
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
Returns:
the last element on the pipeline
fatiando.vis.myv.
title
(text, color=(0, 0, 0), size=0.3, height=1)[source]¶Draw a title on a Mayavi figure.
Warning
Must be called after you’ve plotted something (e.g., prisms) to the figure. This is a bug.
Parameters:
The title
RGB of the color of the text
The size of the text
The height where the title will be placed on the screen
fatiando.vis.myv.
wall_bottom
(bounds, color=(0, 0, 0), opacity=0.1, scale=(1, 1, 1))[source]¶Draw a 3D wall in Mayavi2 on the Bottom side.
Note
Remember that x->North, y->East and z->Down
Parameters:
The extent of the region where the wall is placed
RGB of the color of the wall
Decimal percentage of opacity
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
fatiando.vis.myv.
wall_east
(bounds, color=(0, 0, 0), opacity=0.1, scale=(1, 1, 1))[source]¶Draw a 3D wall in Mayavi2 on the East side.
Note
Remember that x->North, y->East and z->Down
Parameters:
The extent of the region where the wall is placed
RGB of the color of the wall
Decimal percentage of opacity
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
fatiando.vis.myv.
wall_north
(bounds, color=(0, 0, 0), opacity=0.1, scale=(1, 1, 1))[source]¶Draw a 3D wall in Mayavi2 on the North side.
Note
Remember that x->North, y->East and z->Down
Parameters:
The extent of the region where the wall is placed
RGB of the color of the wall
Decimal percentage of opacity
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
fatiando.vis.myv.
wall_south
(bounds, color=(0, 0, 0), opacity=0.1, scale=(1, 1, 1))[source]¶Draw a 3D wall in Mayavi2 on the South side.
Note
Remember that x->North, y->East and z->Down
Parameters:
The extent of the region where the wall is placed
RGB of the color of the wall
Decimal percentage of opacity
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
fatiando.vis.myv.
wall_top
(bounds, color=(0, 0, 0), opacity=0.1, scale=(1, 1, 1))[source]¶Draw a 3D wall in Mayavi2 on the Top side.
Note
Remember that x->North, y->East and z->Down
Parameters:
The extent of the region where the wall is placed
RGB of the color of the wall
Decimal percentage of opacity
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others
fatiando.vis.myv.
wall_west
(bounds, color=(0, 0, 0), opacity=0.1, scale=(1, 1, 1))[source]¶Draw a 3D wall in Mayavi2 on the West side.
Note
Remember that x->North, y->East and z->Down
Parameters:
The extent of the region where the wall is placed
RGB of the color of the wall
Decimal percentage of opacity
Scale factors used to exaggerate on a particular direction, e.g., if scale = (1, 1, 2), the vertical dimension will be 2x larger than the others