Return a copy of x with the elements rotated counterclockwise in 90-degree increments. The second argument is optional, and specifies how many 90-degree rotations are to be applied (the default value is 1). Negative values of n rotate the matrix in a clockwise direction. For example,
rot90 ([1, 2; 3, 4], -1) 3 1 4 2rotates the given matrix clockwise by 90 degrees. The following are all equivalent statements:
rot90 ([1, 2; 3, 4], -1) rot90 ([1, 2; 3, 4], 3) rot90 ([1, 2; 3, 4], 7)Due to the difficulty of defining an axis about which to rotate the matrix
rot90
only work with 2-D arrays. To rotate N-d arrays userotdim
instead.