@@ -1533,12 +1533,17 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
1533
1533
but it also supports color mapping by supplying the *cmap*
1534
1534
argument.
1535
1535
1536
+ The `rstride` and `cstride` kwargs set the stride used to
1537
+ sample the input data to generate the graph. If 1k by 1k
1538
+ arrays are passed in the default values for the strides will
1539
+ result in a 100x100 grid being plotted.
1540
+
1536
1541
============= ================================================
1537
1542
Argument Description
1538
1543
============= ================================================
1539
1544
*X*, *Y*, *Z* Data values as 2D arrays
1540
- *rstride* Array row stride (step size)
1541
- *cstride* Array column stride (step size)
1545
+ *rstride* Array row stride (step size), defaults to 10
1546
+ *cstride* Array column stride (step size), defaults to 10
1542
1547
*color* Color of the surface patches
1543
1548
*cmap* A colormap for the surface patches.
1544
1549
*facecolors* Face colors for the individual patches
@@ -1704,13 +1709,16 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
1704
1709
'''
1705
1710
Plot a 3D wireframe.
1706
1711
1712
+ The `rstride` and `cstride` kwargs set the stride used to
1713
+ sample the input data to generate the graph.
1714
+
1707
1715
========== ================================================
1708
1716
Argument Description
1709
1717
========== ================================================
1710
1718
*X*, *Y*, Data values as 2D arrays
1711
1719
*Z*
1712
- *rstride* Array row stride (step size)
1713
- *cstride* Array column stride (step size)
1720
+ *rstride* Array row stride (step size), defaults to 1
1721
+ *cstride* Array column stride (step size), defaults to 1
1714
1722
========== ================================================
1715
1723
1716
1724
Keyword arguments are passed on to
@@ -2453,34 +2461,34 @@ def calc_arrow(u, v, w, angle=15):
2453
2461
"""
2454
2462
To calculate the arrow head. (u, v, w) should be unit vector.
2455
2463
"""
2456
-
2464
+
2457
2465
# this part figures out the axis of rotation to use
2458
2466
2459
2467
# use unit vector perpendicular to (u,v,w) when |w|=1, by default
2460
- x , y , z = 0 , 1 , 0
2468
+ x , y , z = 0 , 1 , 0
2461
2469
2462
- # get the norm
2463
- norm = math .sqrt (v ** 2 + u ** 2 )
2470
+ # get the norm
2471
+ norm = math .sqrt (v ** 2 + u ** 2 )
2464
2472
# normalize it if it is safe
2465
2473
if norm > 0 :
2466
2474
# get unit direction vector perpendicular to (u,v,w)
2467
- x , y = v / norm , - u / norm
2475
+ x , y = v / norm , - u / norm
2468
2476
2469
- # this function takes an angle, and rotates the (u,v,w)
2477
+ # this function takes an angle, and rotates the (u,v,w)
2470
2478
# angle degrees around (x,y,z)
2471
2479
def rotatefunction (angle ):
2472
- ra = math .radians (angle )
2480
+ ra = math .radians (angle )
2473
2481
c = math .cos (ra )
2474
2482
s = math .sin (ra )
2475
2483
2476
2484
# construct the rotation matrix
2477
2485
R = np .matrix ([[c + (x ** 2 )* (1 - c ), x * y * (1 - c )- z * s , x * z * (1 - c )+ y * s ],
2478
2486
[y * x * (1 - c )+ z * s , c + (y ** 2 )* (1 - c ), y * z * (1 - c )- x * s ],
2479
2487
[z * x * (1 - c )- y * s , z * y * (1 - c )+ x * s , c + (z ** 2 )* (1 - c )]])
2480
-
2488
+
2481
2489
# construct the column vector for (u,v,w)
2482
2490
line = np .matrix ([[u ],[v ],[w ]])
2483
-
2491
+
2484
2492
# use numpy to multiply them to get the rotated vector
2485
2493
rotatedline = R * line
2486
2494
0 commit comments