File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1984,6 +1984,15 @@ def set_paths(self):
1984
1984
def get_datalim (self , transData ):
1985
1985
return (self .get_transform () - transData ).transform_bbox (self ._bbox )
1986
1986
1987
+ def get_coordinates (self ):
1988
+ """
1989
+ Return the vertices of the mesh as an (M, N, 2) array.
1990
+
1991
+ M, N are the number of rows / columns in the mesh.
1992
+ The last dimension specifies the components (x, y).
1993
+ """
1994
+ return self ._coordinates
1995
+
1987
1996
@staticmethod
1988
1997
def convert_mesh_to_paths (meshWidth , meshHeight , coordinates ):
1989
1998
"""
Original file line number Diff line number Diff line change @@ -714,6 +714,18 @@ def test_singleton_autolim():
714
714
np .testing .assert_allclose (ax .get_xlim (), [- 0.06 , 0.06 ])
715
715
716
716
717
+ def test_quadmesh_get_coordinates ():
718
+ x = [0 , 1 , 2 ]
719
+ y = [2 , 4 , 6 ]
720
+ z = np .ones (shape = (2 , 2 ))
721
+ xx , yy = np .meshgrid (x , y )
722
+ coll = plt .pcolormesh (xx , yy , z )
723
+
724
+ # shape (3, 3, 2)
725
+ coords = np .stack ([xx .T , yy .T ]).T
726
+ assert_array_equal (coll .get_coordinates (), coords )
727
+
728
+
717
729
def test_quadmesh_set_array ():
718
730
x = np .arange (4 )
719
731
y = np .arange (4 )
You can’t perform that action at this time.
0 commit comments