docstr: Rotates the layout by the given angle.
docstr_tok: ["Rotates","the","layout","by","the","given","angle","."]
code: def rotate(self, degree: float = 0):
      """
      Rotates the layout by the given angle.
      """
      g = self
  
      angle = math.radians(degree)
  
      if g._point_x is None or g._point_y is None:
          raise ValueError("No point bindings set yet for x/y")
      if g._nodes is None:
          raise ValueError("No points set yet")
      if g._point_x not in g._nodes or g._point_y not in g._nodes:
          raise ValueError(
              f"Did not find position columns {g._point_x} or {g._point_y} in nodes"
          )
  
      g2 = g.nodes(
          g._nodes.assign(
              **{
                  g._point_x: g._nodes[g._point_x] * math.cos(angle)
                  + g._nodes[g._point_y] * math.sin(angle),
                  g._point_y: -g._nodes[g._point_x] * math.sin(angle)
                  + g._nodes[g._point_y] * math.cos(angle),
              }
          )
      )
      return g2
  
file_path: pygraphistry/graphistry/layouts.py
imports: from typing import Any, Callable, cast, Iterable, List, Optional, Set, Union, TYPE_CHECKING
  import math, pandas
  from .Plottable import Plottable
  from .layout import SugiyamaLayout, group_in_a_box_layout
  from .layout.graph import Graph
  from .util import deprecated, setup_logger
label_desc: Use image node_id 4 for calling the LayoutsMixin obj's underlying member method code with example usage: obj.rotate(degree) and returns: g2