Published November 5, 2018
| Version 0.3.4
Software
Open
simpeg/discretize: plot_3d_slicer
Creators
- 1. @seequent
- 2. @simpeg, @geoscixyz, @ubcgif
- 3. Colorado School of Mines - Geophysics - CGEM
- 4. University of British Columbia
- 5. University of British Columbia, Geophysical Inversion Facility
- 6. 3point Science
- 7. @ColoradoSchoolOfMines
- 8. QuantifiedCode
Description
- from pr #104
- commits from @prisae
- review from @lheagy
Add an interactive slicer for 3D volumes. At the moment only implemented for tensor meshes.
Features- Mouse wheel scroll while hovering over a subplot scrolls through the third axis (e.g., hovering over the xy-slice and scrolling your mouse wheel will go through the z-axis).
- The three subplots are synced, also for zooming and moving.
- The initial slices can be provided via the
xslice
,yslice
, andzslice
parameters (default is in the middle of the volume). - Transparency values and ranges can be provided (a list of floats and tuples/lists of two values), e.g. to hide the seawater or to focus on an interesting part, e.g.,
[0.3, [1, 4], [-np.infty, -10]]
to remove all values equal to 0.3, all values between 1 and 4, and all values smaller than -10. For interactive range selection settransparency='slider'
. - Takes
clim
andpcolorOpts
as other mesh-plotting functions, which will be passed topcolormesh
. - By default the horizontal axis is
x
, and the vertical axis isy
; this can be flipped by settingview='yx'
.
By default, the aspect ratio of the three subplots is set to 'auto'
. You can change this with the aspect
parameter, however, expect the unexpected by doing this. Most importantly, the three subplots won't be nicely aligned, and zooming might result in funny arrangements. Two parameters can be used in this respect:
aspect
takes'auto'
,'equal'
, ornum
. A list of two of them can be provided, in which case the first element is for the xy-slice, and the second element for the xz- and zy-slices. E.g.,aspect=['equal', 2]
sets the xy-slice toequal
, and in the other two the vertical dimension is exaggerated by a factor of 2.- The
plot_3d_slicer
is on asubplot2grid
-grid, by default on a 3x3 grid, where 2x2 are used for the xy-slice, 2x1 for the xz-slice, and 1x2 for the zy-slice. You can provide a list of three integers via thegrid
-parameter, which stand for the number of grid-units occupied for the x-, y-, and z-dimension (default is[2, 2, 1]
).
mesh.plot_3d_slicer(data)
It requires %matplotlib notebook
in Jupyter. In regular IPython shells it should just work.
Files
simpeg/discretize-0.3.4.zip
Files
(1.5 MB)
Name | Size | Download all |
---|---|---|
md5:e1fb839875a822bed5c4d9d780adc24f
|
1.5 MB | Preview Download |
Additional details
Related works
- Is supplement to
- https://github.com/simpeg/discretize/tree/0.3.4 (URL)