@@ -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 ,
@@ -253,7 +253,8 @@ def intersections_plane(
253
253
z : float = None
254
254
Position of plane in z direction, only one of x,y,z can be specified to define plane.
255
255
transpose : bool = False
256
- Optional: Swap the coordinates in the plane. (This overrides the default lexicographic axis order.)
256
+ Optional: Swap the coordinates in the plane. (This overrides the
257
+ default lexicographic axis order.)
257
258
258
259
Returns
259
260
-------
@@ -280,7 +281,8 @@ def intersections_2dbox(self, plane: Box, transpose: bool = False) -> list[Shape
280
281
plane : Box
281
282
Plane specification.
282
283
transpose : bool = False
283
- Optional: Swap the coordinates in the plane. (This overrides the default lexicographic axis order.)
284
+ Optional: Swap the coordinates in the plane. (This overrides the
285
+ default lexicographic axis order.)
284
286
285
287
Returns
286
288
-------
@@ -453,9 +455,7 @@ def zero_dims(self) -> list[Axis]:
453
455
return zero_dims
454
456
455
457
def _pop_bounds (
456
- self ,
457
- axis : Axis ,
458
- transpose : bool = False
458
+ self , axis : Axis , transpose : bool = False
459
459
) -> tuple [Coordinate2D , tuple [Coordinate2D , Coordinate2D ]]:
460
460
"""Returns min and max bounds in plane normal to and tangential to ``axis``.
461
461
@@ -464,7 +464,8 @@ def _pop_bounds(
464
464
axis : int
465
465
Integer index into 'xyz' (0,1,2).
466
466
transpose : bool = False
467
- Optional: Swap the coordinates in the plane. (This overrides the default lexicographic axis order.)
467
+ Optional: Swap the coordinates in the plane. (This overrides the
468
+ default lexicographic axis order.)
468
469
469
470
Returns
470
471
-------
@@ -535,7 +536,8 @@ def plot(
535
536
viz_spec : VisualizationSpec = None
536
537
Plotting parameters associated with a medium to use instead of defaults.
537
538
transpose : bool = False
538
- Swap horizontal and vertical axes. (This overrides the default lexicographic axis order.)
539
+ Swap horizontal and vertical axes. (This overrides the default
540
+ lexicographic axis order.)
539
541
**patch_kwargs
540
542
Optional keyword arguments passed to the matplotlib patch plotting of structure.
541
543
For details on accepted values, refer to
@@ -563,7 +565,9 @@ def plot(
563
565
ax = self .add_ax_lims (axis = axis , ax = ax , transpose = transpose )
564
566
ax .set_aspect ("equal" )
565
567
# 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 )
568
+ ax = Box .add_ax_labels_and_title (
569
+ ax = ax , x = x , y = y , z = z , plot_length_units = plot_length_units , transpose = transpose
570
+ )
567
571
return ax
568
572
569
573
def plot_shape (self , shape : Shapely , plot_params : PlotParams , ax : Ax ) -> Ax :
@@ -619,7 +623,8 @@ def _get_plot_labels(axis: Axis, transpose: bool = False) -> tuple[str, str]:
619
623
axis : int
620
624
Integer index into 'xyz' (0,1,2).
621
625
transpose : bool = False
622
- Optional: Swap horizontal and vertical plot labels. (This overrides the default lexicographic axis order.)
626
+ Optional: Swap horizontal and vertical plot labels.
627
+ (This overrides the default lexicographic axis order.)
623
628
624
629
Returns
625
630
-------
@@ -640,6 +645,9 @@ def _get_plot_limits(
640
645
Integer index into 'xyz' (0,1,2).
641
646
buffer : float = 0.3
642
647
Amount of space to add around the limits on the + and - sides.
648
+ transpose : bool = False
649
+ Optional: Swap horizontal and vertical axis limits.
650
+ (This overrides the default lexicographic axis order.)
643
651
644
652
Returns
645
653
-------
@@ -649,7 +657,9 @@ def _get_plot_limits(
649
657
_ , ((xmin , ymin ), (xmax , ymax )) = self ._pop_bounds (axis = axis , transpose = transpose )
650
658
return (xmin - buffer , xmax + buffer ), (ymin - buffer , ymax + buffer )
651
659
652
- def add_ax_lims (self , axis : Axis , ax : Ax , buffer : float = PLOT_BUFFER , transpose : bool = False ) -> Ax :
660
+ def add_ax_lims (
661
+ self , axis : Axis , ax : Ax , buffer : float = PLOT_BUFFER , transpose : bool = False
662
+ ) -> Ax :
653
663
"""Sets the horizontal and vertical axis limits based on ``self.bounds``.
654
664
655
665
Parameters
@@ -661,14 +671,17 @@ def add_ax_lims(self, axis: Axis, ax: Ax, buffer: float = PLOT_BUFFER, transpose
661
671
buffer : float = 0.3
662
672
Amount of space to place around the limits on the + and - sides.
663
673
transpose : bool = False
664
- Optional: Swap horizontal and vertical axis limits. (This overrides the default lexicographic axis order.)
674
+ Optional: Swap horizontal and vertical axis limits.
675
+ (This overrides the default lexicographic axis order.)
665
676
666
677
Returns
667
678
-------
668
679
matplotlib.axes._subplots.Axes
669
680
The supplied or created matplotlib axes.
670
681
"""
671
- (xmin , xmax ), (ymin , ymax ) = self ._get_plot_limits (axis = axis , buffer = buffer , transpose = transpose )
682
+ (xmin , xmax ), (ymin , ymax ) = self ._get_plot_limits (
683
+ axis = axis , buffer = buffer , transpose = transpose
684
+ )
672
685
673
686
# note: axes limits dont like inf values, so we need to evaluate them first if present
674
687
xmin , xmax , ymin , ymax = self ._evaluate_inf ((xmin , xmax , ymin , ymax ))
@@ -703,7 +716,8 @@ def add_ax_labels_and_title(
703
716
When set to a supported ``LengthUnit``, plots will be produced with annotated axes
704
717
and title with the proper units.
705
718
transpose : bool = False
706
- Optional: Swap horizontal and vertical axis labels. (This overrides the default lexicographic axis order.)
719
+ Optional: Swap horizontal and vertical axis labels.
720
+ (This overrides the default lexicographic axis order.)
707
721
708
722
Returns
709
723
-------
@@ -782,20 +796,20 @@ def pop_axis_and_swap(
782
796
transpose : bool = False ,
783
797
) -> tuple [Any , tuple [Any , Any ]]:
784
798
"""
785
- pop_axis_and_swap() is identical to pop_axis(), except that accepts an
786
- additional " transpose" argument which reverses the output order. Examples:
799
+ `` pop_axis_and_swap()`` is identical to `` pop_axis()`` , except that it accepts an
800
+ additional `` transpose`` argument which reverses the output order. Examples:
787
801
788
- pop_axis_and_swap(("x", "y", "z"), 1, transpose=False) -> "y", ("x", "z")
789
- pop_axis_and_swap(("x", "y", "z"), 1, transpose=True) -> "y", ("z", "x")
802
+ `` pop_axis_and_swap(("x", "y", "z"), 1, transpose=False)`` -> ``( "y", ("x", "z"))``
803
+ `` pop_axis_and_swap(("x", "y", "z"), 1, transpose=True)`` -> ``( "y", ("z", "x"))``
790
804
791
805
Parameters
792
806
----------
793
807
coord : Tuple[Any, Any, Any]
794
808
Tuple of three values in original coordinate system.
795
809
axis : int
796
810
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?
811
+ transpose : bool = False
812
+ Optional: Swap the order of the data from the two remaining axes in the output tuple.
799
813
800
814
Returns
801
815
-------
@@ -843,15 +857,15 @@ def unpop_axis_and_swap(
843
857
transpose : bool = False ,
844
858
) -> tuple [Any , Any , Any ]:
845
859
"""
846
- unpop_axis_and_swap() is identical to unpop_axis(), except that accepts
847
- an additional " transpose" argument which reverses the order of
848
- plane_coords before sending them to unpop_axis(). For example:
860
+ `` unpop_axis_and_swap()`` is identical to `` unpop_axis()`` , except that
861
+ it accepts an additional `` transpose`` argument which reverses the order of
862
+ `` plane_coords`` before sending them to `` unpop_axis()`` . For example:
849
863
850
- unpop_axis_and_swap("y", ("x", "z"), 1, transpose=False) --> ("x", "y", "z")
851
- unpop_axis_and_swap("y", ("x", "z"), 1, transpose=True) --> ("z", "y", "x")
864
+ `` unpop_axis_and_swap("y", ("x", "z"), 1, transpose=False)`` --> `` ("x", "y", "z")``
865
+ `` unpop_axis_and_swap("y", ("x", "z"), 1, transpose=True)`` --> `` ("z", "y", "x")``
852
866
853
- This function is the inverse of pop_axis_and_swap(). For example:
854
- unpop_axis_and_swap("y", ("z", "x"), 1, transpose=True) --> ("x", "y", "z")
867
+ This function is the inverse of `` pop_axis_and_swap()`` . For example:
868
+ `` unpop_axis_and_swap("y", ("z", "x"), 1, transpose=True)`` --> `` ("x", "y", "z")``
855
869
856
870
Parameters
857
871
----------
@@ -861,8 +875,9 @@ def unpop_axis_and_swap(
861
875
Values along ordered planar directions.
862
876
axis : int
863
877
Integer index into 'xyz' (0,1,2).
864
- transpose: bool = False
865
- Optional: Swap the order of the entries in plane_coords[]?
878
+ transpose : bool = False
879
+ Optional: Swap the order of the entries in plane_coords[].
880
+ (This overrides the default lexicographic axis order.)
866
881
867
882
Returns
868
883
-------
@@ -1679,7 +1694,7 @@ def intersections_tilted_plane(
1679
1694
axis = np .argmax (np .abs (normal )).item ()
1680
1695
coord = "xyz" [axis ]
1681
1696
kwargs = {coord : origin [axis ]}
1682
- section = self .intersections_plane (** kwargs ) # <-- BUG?: X,Y axis order ignores normal axis direction +/-
1697
+ section = self .intersections_plane (** kwargs )
1683
1698
# Apply transformation in the plane by removing row and column
1684
1699
to_2D_in_plane = np .delete (np .delete (to_2D , 2 , 0 ), axis , 1 )
1685
1700
@@ -1793,6 +1808,7 @@ def intersections_plane(
1793
1808
Position of plane in z direction, only one of x,y,z can be specified to define plane.
1794
1809
transpose : bool = False
1795
1810
Optional: Swap the coordinates in the plane before calculating intersections.
1811
+ (This overrides the default lexicographic axis order.)
1796
1812
1797
1813
Returns
1798
1814
-------
@@ -1818,6 +1834,7 @@ def _intersections_normal(self, z: float, transpose: bool = False) -> list:
1818
1834
Position along the axis normal to slab
1819
1835
transpose : bool = False
1820
1836
Optional: Swap the coordinates in the plane before calculating intersections.
1837
+ (This overrides the default lexicographic axis order.)
1821
1838
1822
1839
Returns
1823
1840
-------
@@ -1838,7 +1855,8 @@ def _intersections_side(self, position: float, axis: Axis, transpose: bool = Fal
1838
1855
axis : int
1839
1856
Integer index into 'xyz' (0,1,2).
1840
1857
transpose : bool = False
1841
- Optional: Swap the coordinates in the perpendicular plane before calculating intersections.
1858
+ Optional: Swap the coordinates in the perpendicular plane before calculating
1859
+ intersections. (This overrides the default lexicographic axis order.)
1842
1860
1843
1861
Returns
1844
1862
-------
@@ -1866,11 +1884,7 @@ def _order_axis(self, axis: int) -> int:
1866
1884
return axis_index [axis ]
1867
1885
1868
1886
def _order_by_axis (
1869
- self ,
1870
- plane_val : Any ,
1871
- axis_val : Any ,
1872
- axis : int ,
1873
- transpose : bool = False
1887
+ self , plane_val : Any , axis_val : Any , axis : int , transpose : bool = False
1874
1888
) -> tuple [Any , Any ]:
1875
1889
"""Orders a value in the plane and value along axis in correct (x,y) order for plotting.
1876
1890
Note: sometimes if axis=1 and we compute cross section values orthogonal to axis,
@@ -1886,7 +1900,7 @@ def _order_by_axis(
1886
1900
axis : int
1887
1901
Integer index into the structure's planar axis.
1888
1902
transpose : bool
1889
- Optional: Swap the order of the remaining two axes (the ones not equal to axis)
1903
+ Optional: Swap the order for the remaining two axes (the axes not equal to axis).
1890
1904
1891
1905
Returns
1892
1906
-------
@@ -2160,9 +2174,9 @@ def _do_intersections_tilted_plane(
2160
2174
return path .polygons_full
2161
2175
2162
2176
def intersections_plane (
2163
- self ,
2164
- x : Optional [float ] = None ,
2165
- y : Optional [float ] = None ,
2177
+ self ,
2178
+ x : Optional [float ] = None ,
2179
+ y : Optional [float ] = None ,
2166
2180
z : Optional [float ] = None ,
2167
2181
transpose : bool = False ,
2168
2182
):
@@ -2178,6 +2192,7 @@ def intersections_plane(
2178
2192
Position of plane in z direction, only one of x,y,z can be specified to define plane.
2179
2193
transpose : bool = False
2180
2194
Optional: Swap the coordinates in the plane before calculating intersections.
2195
+ (This overrides the default lexicographic axis order.)
2181
2196
2182
2197
Returns
2183
2198
-------
@@ -2265,7 +2280,10 @@ def intersections_with(self, other, transpose: bool = False):
2265
2280
shapes_plane = other .intersections_plane (** xyz_kwargs , transpose = transpose )
2266
2281
2267
2282
# 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 )
2283
+ bs_min , bs_max = (
2284
+ self .pop_axis_and_swap (bounds , axis = normal_ind , transpose = transpose )[1 ]
2285
+ for bounds in self .bounds
2286
+ )
2269
2287
2270
2288
shapely_box = self .make_shapely_box (bs_min [0 ], bs_min [1 ], bs_max [0 ], bs_max [1 ])
2271
2289
shapely_box = Geometry .evaluate_inf_shape (shapely_box )
@@ -2360,7 +2378,8 @@ def _plot_arrow(
2360
2378
arrow_base : :class:`.Coordinate` = None
2361
2379
Custom base of the arrow. Uses the geometry's center if not provided.
2362
2380
transpose : bool = False
2363
- Swap horizontal and vertical axes. (This overrides the default lexicographic axis order.)
2381
+ Swap horizontal and vertical axes.
2382
+ (This overrides the default lexicographic axis order.)
2364
2383
2365
2384
Returns
2366
2385
-------
@@ -2373,7 +2392,9 @@ def _plot_arrow(
2373
2392
2374
2393
# conditions to check to determine whether to plot arrow, taking into account the
2375
2394
# possibility of a custom arrow base
2376
- arrow_intersecting_plane = len (self .intersections_plane (x = x , y = y , z = z , transpose = transpose )) > 0
2395
+ arrow_intersecting_plane = (
2396
+ len (self .intersections_plane (x = x , y = y , z = z , transpose = transpose )) > 0
2397
+ )
2377
2398
center = self .center
2378
2399
if arrow_base :
2379
2400
arrow_intersecting_plane = arrow_intersecting_plane and any (
@@ -3086,6 +3107,7 @@ def intersections_plane(
3086
3107
Position of plane in z direction, only one of x,y,z can be specified to define plane.
3087
3108
transpose : bool = False
3088
3109
Optional: Swap the coordinates in the plane before calculating intersections.
3110
+ (This overrides the default lexicographic axis order.)
3089
3111
3090
3112
Returns
3091
3113
-------
@@ -3300,6 +3322,7 @@ def intersections_plane(
3300
3322
Position of plane in z direction, only one of x,y,z can be specified to define plane.
3301
3323
transpose : bool = False
3302
3324
Optional: Swap the coordinates in the plane before calculating intersections.
3325
+ (This overrides the default lexicographic axis order.)
3303
3326
3304
3327
Returns
3305
3328
-------
0 commit comments