class_docstr: Represents the layout of a graph.
  
  A layout is practically a list of coordinates in an n-dimensional
  space. This class is generic in the sense that it can store coordinates
  in any n-dimensional space.
  
  Layout objects are not associated directly with a graph. This is deliberate:
  there were times when I worked with almost identical copies of the same
  graph, the only difference was that they had different colors assigned to
  the vertices. It was particularly convenient for me to use the same layout
  for all of them, especially when I made figures for a paper. However,
  C{igraph} will of course refuse to draw a graph with a layout that has
  less coordinates than the node count of the graph.
  
  Layouts behave exactly like lists when they are accessed using the item
  index operator (C{[...]}). They can even be iterated through. Items
  returned by the index operator are only copies of the coordinates,
  but the stored coordinates can be modified by directly assigning to
  an index.
  
      >>> layout = Layout([(0, 1), (0, 2)])
      >>> coords = layout[1]
      >>> print(coords)
      [0, 2]
      >>> coords = (0, 3)
      >>> print(layout[1])
      [0, 2]
      >>> layout[1] = coords
      >>> print(layout[1])
      [0, 3]
docstr: Converts a planar layout to a radial one
  
  This method applies only to 2D layouts. The X coordinate of the
  layout is transformed to an angle, with min(x) corresponding to
  the parameter called I{min_angle} and max(y) corresponding to
  I{max_angle}. Angles are given in degrees, zero degree corresponds
  to the direction pointing upwards. The Y coordinate is
  interpreted as a radius, with min(y) belonging to the minimum and
  max(y) to the maximum radius given in the arguments.
  
  This is not a fully generic polar coordinate transformation, but
  it is fairly useful in creating radial tree layouts from ordinary
  top-down ones (that's why the Y coordinate belongs to the radius).
  It can also be used in conjunction with the Fruchterman-Reingold
  layout algorithm via its I{miny} and I{maxy} parameters (see
  L{Graph.layout_fruchterman_reingold()<GraphBase.layout_fruchterman_reingold()>})
  to produce radial layouts where the radius belongs to some property of
  the vertices.
  
  @param min_angle: the angle corresponding to the minimum X value
  @param max_angle: the angle corresponding to the maximum X value
  @param min_radius: the radius corresponding to the minimum Y value
  @param max_radius: the radius corresponding to the maximum Y value
docstr_tok: ["Converts","a","planar","layout","to","a","radial","one","This","method","applies","only","to","2D","layouts",".","The","X","coordinate","of","the","layout","is","transformed","to","an","angle",",","with","min","(","x",")","corresponding","to","the","parameter","called","I","{","min_angle","}","and","max","(","y",")","corresponding","to","I","{","max_angle","}",".","Angles","are","given","in","degrees",",","zero","degree","corresponds","to","the","direction","pointing","upwards",".","The","Y","coordinate","is","interpreted","as","a","radius",",","with","min","(","y",")","belonging","to","the","minimum","and","max","(","y",")","to","the","maximum","radius","given","in","the","arguments",".","This","is","not","a","fully","generic","polar","coordinate","transformation",",","but","it","is","fairly","useful","in","creating","radial","tree","layouts","from","ordinary","top-down","ones","(","that","'s","why","the","Y","coordinate","belongs","to","the","radius",")",".","It","can","also","be","used","in","conjunction","with","the","Fruchterman-Reingold","layout","algorithm","via","its","I","{","miny","}","and","I","{","maxy","}","parameters","(","see","L","{","Graph.layout_fruchterman_reingold","(",")","<","GraphBase.layout_fruchterman_reingold","(",")",">","}",")","to","produce","radial","layouts","where","the","radius","belongs","to","some","property","of","the","vertices",".","@","param","min_angle",":","the","angle","corresponding","to","the","minimum","X","value","@","param","max_angle",":","the","angle","corresponding","to","the","maximum","X","value","@","param","min_radius",":","the","radius","corresponding","to","the","minimum","Y","value","@","param","max_radius",":","the","radius","corresponding","to","the","maximum","Y","value"]
code: def to_radial(
      self, min_angle=100, max_angle=80, min_radius=0.0, max_radius=1.0
  ):
      """Converts a planar layout to a radial one
  
      This method applies only to 2D layouts. The X coordinate of the
      layout is transformed to an angle, with min(x) corresponding to
      the parameter called I{min_angle} and max(y) corresponding to
      I{max_angle}. Angles are given in degrees, zero degree corresponds
      to the direction pointing upwards. The Y coordinate is
      interpreted as a radius, with min(y) belonging to the minimum and
      max(y) to the maximum radius given in the arguments.
  
      This is not a fully generic polar coordinate transformation, but
      it is fairly useful in creating radial tree layouts from ordinary
      top-down ones (that's why the Y coordinate belongs to the radius).
      It can also be used in conjunction with the Fruchterman-Reingold
      layout algorithm via its I{miny} and I{maxy} parameters (see
      L{Graph.layout_fruchterman_reingold()<GraphBase.layout_fruchterman_reingold()>})
      to produce radial layouts where the radius belongs to some property of
      the vertices.
  
      @param min_angle: the angle corresponding to the minimum X value
      @param max_angle: the angle corresponding to the maximum X value
      @param min_radius: the radius corresponding to the minimum Y value
      @param max_radius: the radius corresponding to the maximum Y value
      """
      if self._dim != 2:
          raise TypeError("implemented only for 2D layouts")
      bbox = self.bounding_box()
  
      while min_angle > max_angle:
          max_angle += 360
      while min_angle > 360:
          min_angle -= 360
          max_angle -= 360
      while min_angle < 0:
          min_angle += 360
          max_angle += 360
  
      ratio_x = (max_angle - min_angle) / bbox.width
      ratio_x *= pi / 180.0
      min_angle *= pi / 180.0
      ratio_y = (max_radius - min_radius) / bbox.height
      for idx, (x, y) in enumerate(self._coords):
          alpha = (x - bbox.left) * ratio_x + min_angle
          radius = (y - bbox.top) * ratio_y + min_radius
          self._coords[idx] = [
              cos(alpha) * radius,
              -sin(alpha) * radius,
          ]
  
imports: from math import sin, cos, pi
  from igraph._igraph import GraphBase
  from igraph.drawing.utils import BoundingBox
  from igraph.statistics import RunningMean
label_desc: Use image node_id 15 for calling the Layout obj's underlying member method code with example usage: obj.to_radial(min_angle, max_angle, min_radius, max_radius) without return types