MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / draw_line

Method draw_line

utils/visualizer.py:1016–1045  ·  view source on GitHub ↗

Args: x_data (list[int]): a list containing x values of all the points being drawn. Length of list should match the length of y_data. y_data (list[int]): a list containing y values of all the points being drawn. Length of list should m

(self, x_data, y_data, color, linestyle="-", linewidth=None)

Source from the content-addressed store, hash-verified

1014 return self.output
1015
1016 def draw_line(self, x_data, y_data, color, linestyle="-", linewidth=None):
1017 """
1018 Args:
1019 x_data (list[int]): a list containing x values of all the points being drawn.
1020 Length of list should match the length of y_data.
1021 y_data (list[int]): a list containing y values of all the points being drawn.
1022 Length of list should match the length of x_data.
1023 color: color of the line. Refer to `matplotlib.colors` for a full list of
1024 formats that are accepted.
1025 linestyle: style of the line. Refer to `matplotlib.lines.Line2D`
1026 for a full list of formats that are accepted.
1027 linewidth (float or None): width of the line. When it's None,
1028 a default value will be computed and used.
1029
1030 Returns:
1031 output (VisImage): image object with line drawn.
1032 """
1033 if linewidth is None:
1034 linewidth = self._default_font_size / 3
1035 linewidth = max(linewidth, 1)
1036 self.output.ax.add_line(
1037 mpl.lines.Line2D(
1038 x_data,
1039 y_data,
1040 linewidth=linewidth * self.output.scale,
1041 color=color,
1042 linestyle=linestyle,
1043 )
1044 )
1045 return self.output
1046
1047 def draw_binary_mask(
1048 self, binary_mask, color=None, *, edge_color=None, text=None, alpha=0.7, area_threshold=10

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected