@@ -236,7 +236,7 @@ def intersections_tilted_plane(
236
236
"""
237
237
238
238
def intersections_plane (
239
- self ,
239
+ self ,
240
240
x : Optional [float ] = None ,
241
241
y : Optional [float ] = None ,
242
242
z : Optional [float ] = None ,
@@ -453,9 +453,7 @@ def zero_dims(self) -> list[Axis]:
453
453
return zero_dims
454
454
455
455
def _pop_bounds (
456
- self ,
457
- axis : Axis ,
458
- transpose : bool = False
456
+ self , axis : Axis , transpose : bool = False
459
457
) -> tuple [Coordinate2D , tuple [Coordinate2D , Coordinate2D ]]:
460
458
"""Returns min and max bounds in plane normal to and tangential to ``axis``.
461
459
@@ -563,7 +561,9 @@ def plot(
563
561
ax = self .add_ax_lims (axis = axis , ax = ax , transpose = transpose )
564
562
ax .set_aspect ("equal" )
565
563
# Add the default axis labels, tick labels, and title
566
- ax = Box .add_ax_labels_and_title (ax = ax , x = x , y = y , z = z , plot_length_units = plot_length_units , transpose = transpose )
564
+ ax = Box .add_ax_labels_and_title (
565
+ ax = ax , x = x , y = y , z = z , plot_length_units = plot_length_units , transpose = transpose
566
+ )
567
567
return ax
568
568
569
569
def plot_shape (self , shape : Shapely , plot_params : PlotParams , ax : Ax ) -> Ax :
@@ -649,7 +649,9 @@ def _get_plot_limits(
649
649
_ , ((xmin , ymin ), (xmax , ymax )) = self ._pop_bounds (axis = axis , transpose = transpose )
650
650
return (xmin - buffer , xmax + buffer ), (ymin - buffer , ymax + buffer )
651
651
652
- def add_ax_lims (self , axis : Axis , ax : Ax , buffer : float = PLOT_BUFFER , transpose : bool = False ) -> Ax :
652
+ def add_ax_lims (
653
+ self , axis : Axis , ax : Ax , buffer : float = PLOT_BUFFER , transpose : bool = False
654
+ ) -> Ax :
653
655
"""Sets the horizontal and vertical axis limits based on ``self.bounds``.
654
656
655
657
Parameters
@@ -668,7 +670,9 @@ def add_ax_lims(self, axis: Axis, ax: Ax, buffer: float = PLOT_BUFFER, transpose
668
670
matplotlib.axes._subplots.Axes
669
671
The supplied or created matplotlib axes.
670
672
"""
671
- (xmin , xmax ), (ymin , ymax ) = self ._get_plot_limits (axis = axis , buffer = buffer , transpose = transpose )
673
+ (xmin , xmax ), (ymin , ymax ) = self ._get_plot_limits (
674
+ axis = axis , buffer = buffer , transpose = transpose
675
+ )
672
676
673
677
# note: axes limits dont like inf values, so we need to evaluate them first if present
674
678
xmin , xmax , ymin , ymax = self ._evaluate_inf ((xmin , xmax , ymin , ymax ))
@@ -763,7 +767,6 @@ def pop_axis(
763
767
axis : int
764
768
Integer index into 'xyz' (0,1,2).
765
769
766
-
767
770
Returns
768
771
-------
769
772
Any, Tuple[Any, Any]
@@ -794,8 +797,8 @@ def pop_axis_and_swap(
794
797
Tuple of three values in original coordinate system.
795
798
axis : int
796
799
Integer index into 'xyz' (0,1,2).
797
- transpose: bool = False
798
- Optional: Swap the order of the data from the two remaining axes in the output tuple?
800
+ transpose : bool = False
801
+ Optional: Swap the order of the data from the two remaining axes in the output tuple.
799
802
800
803
Returns
801
804
-------
@@ -862,7 +865,7 @@ def unpop_axis_and_swap(
862
865
axis : int
863
866
Integer index into 'xyz' (0,1,2).
864
867
transpose: bool = False
865
- Optional: Swap the order of the entries in plane_coords[]?
868
+ Optional: Swap the order of the entries in plane_coords[].
866
869
867
870
Returns
868
871
-------
@@ -1679,7 +1682,7 @@ def intersections_tilted_plane(
1679
1682
axis = np .argmax (np .abs (normal )).item ()
1680
1683
coord = "xyz" [axis ]
1681
1684
kwargs = {coord : origin [axis ]}
1682
- section = self .intersections_plane (** kwargs ) # <-- BUG?: X,Y axis order ignores normal axis direction +/-
1685
+ section = self .intersections_plane (** kwargs )
1683
1686
# Apply transformation in the plane by removing row and column
1684
1687
to_2D_in_plane = np .delete (np .delete (to_2D , 2 , 0 ), axis , 1 )
1685
1688
@@ -1866,11 +1869,7 @@ def _order_axis(self, axis: int) -> int:
1866
1869
return axis_index [axis ]
1867
1870
1868
1871
def _order_by_axis (
1869
- self ,
1870
- plane_val : Any ,
1871
- axis_val : Any ,
1872
- axis : int ,
1873
- transpose : bool = False
1872
+ self , plane_val : Any , axis_val : Any , axis : int , transpose : bool = False
1874
1873
) -> tuple [Any , Any ]:
1875
1874
"""Orders a value in the plane and value along axis in correct (x,y) order for plotting.
1876
1875
Note: sometimes if axis=1 and we compute cross section values orthogonal to axis,
@@ -2160,9 +2159,9 @@ def _do_intersections_tilted_plane(
2160
2159
return path .polygons_full
2161
2160
2162
2161
def intersections_plane (
2163
- self ,
2164
- x : Optional [float ] = None ,
2165
- y : Optional [float ] = None ,
2162
+ self ,
2163
+ x : Optional [float ] = None ,
2164
+ y : Optional [float ] = None ,
2166
2165
z : Optional [float ] = None ,
2167
2166
transpose : bool = False ,
2168
2167
):
@@ -2265,7 +2264,10 @@ def intersections_with(self, other, transpose: bool = False):
2265
2264
shapes_plane = other .intersections_plane (** xyz_kwargs , transpose = transpose )
2266
2265
2267
2266
# intersect all shapes with the input self
2268
- bs_min , bs_max = (self .pop_axis_and_swap (bounds , axis = normal_ind , transpose = transpose )[1 ] for bounds in self .bounds )
2267
+ bs_min , bs_max = (
2268
+ self .pop_axis_and_swap (bounds , axis = normal_ind , transpose = transpose )[1 ]
2269
+ for bounds in self .bounds
2270
+ )
2269
2271
2270
2272
shapely_box = self .make_shapely_box (bs_min [0 ], bs_min [1 ], bs_max [0 ], bs_max [1 ])
2271
2273
shapely_box = Geometry .evaluate_inf_shape (shapely_box )
@@ -2360,7 +2362,8 @@ def _plot_arrow(
2360
2362
arrow_base : :class:`.Coordinate` = None
2361
2363
Custom base of the arrow. Uses the geometry's center if not provided.
2362
2364
transpose : bool = False
2363
- Swap horizontal and vertical axes. (This overrides the default lexicographic axis order.)
2365
+ Swap horizontal and vertical axes. (This overrides the default
2366
+ lexicographic axis order.)
2364
2367
2365
2368
Returns
2366
2369
-------
@@ -2373,7 +2376,9 @@ def _plot_arrow(
2373
2376
2374
2377
# conditions to check to determine whether to plot arrow, taking into account the
2375
2378
# possibility of a custom arrow base
2376
- arrow_intersecting_plane = len (self .intersections_plane (x = x , y = y , z = z , transpose = transpose )) > 0
2379
+ arrow_intersecting_plane = (
2380
+ len (self .intersections_plane (x = x , y = y , z = z , transpose = transpose )) > 0
2381
+ )
2377
2382
center = self .center
2378
2383
if arrow_base :
2379
2384
arrow_intersecting_plane = arrow_intersecting_plane and any (
0 commit comments