@@ -83,7 +83,7 @@ def _check_model(self, model: GeologicalModel) -> GeologicalModel:
8383 return model
8484
8585 def _get_vector_scale (self , scale : Optional [Union [float , int ]]) -> float :
86- autoscale = 0 .0
86+ autoscale = 1 .0
8787 if self .model is not None :
8888 # automatically scale vector data to be 5% of the bounding box length
8989 autoscale = self .model .bounding_box .length .max () * 0.05
@@ -207,6 +207,7 @@ def plot_scalar_field(
207207 scalar_bar : bool = False ,
208208 slicer : bool = False ,
209209 name : Optional [str ] = None ,
210+ bounding_box : Optional [BoundingBox ] = None ,
210211 ):
211212 """Plot a volume with the scalar field as the property
212213 calls feature.scalar_field() to get the scalar field and
@@ -243,7 +244,7 @@ def plot_scalar_field(
243244 name = geological_feature .name + '_scalar_field'
244245 name = self .increment_name (name ) # , 'scalar_field')
245246
246- volume = geological_feature .scalar_field ().vtk ()
247+ volume = geological_feature .scalar_field (bounding_box = bounding_box ).vtk ()
247248 if vmin is not None :
248249 pyvista_kwargs ["clim" ][0 ] = vmin
249250 if vmax is not None :
@@ -476,6 +477,7 @@ def plot_vector_field(
476477 normalise : bool = False ,
477478 scale_function : Optional [Callable [[np .ndarray ], np .ndarray ]] = None ,
478479 pyvista_kwargs : dict = {},
480+ bounding_box : Optional [BoundingBox ] = None ,
479481 ) -> pv .Actor :
480482 """Plot a vector field
481483
@@ -498,8 +500,9 @@ def plot_vector_field(
498500 if name is None :
499501 name = geological_feature .name + '_vector_field'
500502 name = self .increment_name (name ) # , 'vector_field')
501- vectorfield = geological_feature .vector_field ()
503+ vectorfield = geological_feature .vector_field (bounding_box = bounding_box )
502504 scale = self ._get_vector_scale (scale )
505+ print (scale )
503506 return self .add_mesh (
504507 vectorfield .vtk (
505508 scale = scale ,
@@ -615,6 +618,7 @@ def plot_fault(
615618 name : Optional [str ] = None ,
616619 geom : str = "arrow" ,
617620 pyvista_kwargs : dict = {},
621+ bounding_box : Optional [BoundingBox ] = None ,
618622 ) -> List [pv .Actor ]:
619623 """Plot a fault including the surface, slip vector and displacement volume
620624
@@ -649,7 +653,7 @@ def plot_fault(
649653 else :
650654 surface_name = f'{ fault .name } _surface_{ name } '
651655 surface_name = self .increment_name (surface_name )
652- surf = fault .surfaces ([0 ])[0 ]
656+ surf = fault .surfaces ([0 ], bounding_box = bounding_box )[0 ]
653657 actors .append (self .add_mesh (surf .vtk (), name = surface_name , ** pyvista_kwargs ))
654658 if slip_vector :
655659 if name is None :
@@ -658,7 +662,7 @@ def plot_fault(
658662 vector_name = f'{ fault .name } _vector_{ name } '
659663 vector_name = self .increment_name (vector_name )
660664
661- vectorfield = fault .vector_field ()
665+ vectorfield = fault .vector_field (bounding_box = bounding_box )
662666 vector_scale = self ._get_vector_scale (vector_scale )
663667 actors .append (
664668 self .add_mesh (
@@ -672,7 +676,9 @@ def plot_fault(
672676 volume_name = fault .name + '_volume'
673677 else :
674678 volume_name = f'{ fault .name } _volume_{ name } '
675- volume = fault .displacementfeature .scalar_field ()
679+
680+ volume = fault .displacementfeature .scalar_field (bounding_box = bounding_box )
681+
676682 volume = volume .vtk ().threshold ([- 1.0 , 1.0 ])
677683 if geom == "arrow" :
678684 geom = pv .Arrow ()
@@ -709,7 +715,7 @@ def plot_fault_ellipsoid(
709715 name = fault .name + '_ellipsoid'
710716 name = self .increment_name (name )
711717 ellipsoid = fault .fault_ellipsoid ()
712- return self .add_mesh (ellipsoid . vtk () , name = name , ** pyvista_kwargs )
718+ return self .add_mesh (ellipsoid , name = name , ** pyvista_kwargs )
713719
714720 def rotate (self , angles : np .ndarray ):
715721 """Rotate the camera by the given angles
0 commit comments