Пример #1
0
  def __init__(self, center_of_rotation, **kwargs):
    super(Label, self).__init__(center_of_rotation, **kwargs)

    self._get_label_locations()
    self.label_location = process_label_location('center', kwargs)
    self.label_string = process_label_string(None, kwargs)
    self.label_angle = process_label_angle(0.0, kwargs)
    self.label_pad = process_label_pad(1.0, kwargs)
    self.font_size = process_font_size(12, kwargs)
    self.label = None
Пример #2
0
  def draw_label(self, name, **kwargs):
    self.label_angle = process_label_angle(self.label_angle, kwargs)
    self.label_pad = process_label_pad(self.label_pad, kwargs)
    self.font_size = process_font_size(self.font_size, kwargs)
    self.label_location = process_label_location(self.label_location, kwargs)

    self._get_label_locations()
    if self.draw_label_bool:
      self.label_string = name
      super(Node, self).draw_label()
      return self.label
    else:
      return None
Пример #3
0
    def draw_label(self, name, **kwargs):
        self.label_angle = process_label_angle(self.label_angle, kwargs)
        self.label_pad = process_label_pad(self.label_pad, kwargs)
        self.font_size = process_font_size(self.font_size, kwargs)
        self.label_location = process_label_location(self.label_location,
                                                     kwargs)

        self._get_label_locations()
        if self.draw_label_bool:
            self.label_string = name
            super(Node, self).draw_label()
            return self.label
        else:
            return None
Пример #4
0
  def draw_label(self, **kwargs):
    self.label_angle = process_label_angle(self.label_angle, kwargs)
    self.label_pad = process_label_pad(self.label_pad, kwargs)
    self.font_size = process_font_size(self.font_size, kwargs)
    self.label_location = process_label_location(self.label_location, kwargs)

    if self.label_string is not None:
      self._guess_label_coordinates()
      self.label = plt.text(self._label_coordinates.x,
                            self._label_coordinates.y, self.label_string,
                            ha="center", va="center", size=self.font_size,
                            rotation=0.0
                           )
      return self.label
    else:
      return None