def plot(self, pts_per_edge, color=None, ax=None, with_nodes=False): """Plot the current surface. Args: pts_per_edge (int): Number of points to plot per edge. color (Optional[Tuple[float, float, float]]): Color as RGB profile. ax (Optional[matplotlib.artist.Artist]): matplotlib axis object to add plot to. with_nodes (Optional[bool]): Determines if the control points should be added to the plot. Off by default. Returns: matplotlib.artist.Artist: The axis containing the plot. This may be a newly created axis. Raises: NotImplementedError: If the surface's dimension is not ``2``. """ if self._dimension != 2: raise NotImplementedError('2D is the only supported dimension', 'Current dimension', self._dimension) if ax is None: ax = _plot_helpers.new_axis() _plot_helpers.add_patch(ax, color, pts_per_edge, *self._get_edges()) if with_nodes: ax.plot(self._nodes[:, 0], self._nodes[:, 1], color='black', marker='o', linestyle='None') return ax
def plot(self, pts_per_edge, color=None, ax=None): """Plot the current curved polygon. Args: pts_per_edge (int): Number of points to plot per curved edge. color (Optional[Tuple[float, float, float]]): Color as RGB profile. ax (Optional[matplotlib.artist.Artist]): matplotlib axis object to add plot to. Returns: matplotlib.artist.Artist: The axis containing the plot. This may be a newly created axis. """ if ax is None: ax = _plot_helpers.new_axis() _plot_helpers.add_patch(ax, color, pts_per_edge, *self._edges) return ax
def _call_function_under_test(ax, color, pts_per_edge, *edges): from bezier import _plot_helpers return _plot_helpers.add_patch(ax, color, pts_per_edge, *edges)