benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf cfa307c8-4a56-5cc1-84c3-67713441d313

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import matplotlib
import numpy as np


def task_func(ax, num_points):
    """
    Plots "num_points" random points on the polar diagram represented by "ax."
    The radial ticks on the plot are positioned based on the number of points divided by 10 degrees.

    Parameters:
    ax (matplotlib.axes._axes.Axes): The Axes object for the polar plot.
    num_points (int): The number of random points to generate and plot.

    Returns:
    matplotlib.axes._axes.Axes: The modified Axes object with plotted points.

    Raises:
    - This function will raise a ValueError if the input ax is not and Axes.
    - This function will raise a ValueError if it is use the negative number as num_points.

    Requirements:
    - matplotlib
    - numpy

    Example:
    >>> np.random.seed(0)
    >>> fig = plt.figure()
    >>> ax = fig.add_subplot(111, polar=True)
    >>> ax = task_func(ax, 100)
    >>> ax.get_rlabel_position()
    10.0
    >>> plt.close()
    """

instruct prompt

Plots "num_points" random points on the polar diagram represented by "ax." The radial ticks on the plot are positioned based on the number of points divided by 10 degrees.
The function should raise the exception for: This function will raise a ValueError if the input ax is not and Axes. This function will raise a ValueError if it is use the negative number as num_points.
The function should output with:
    matplotlib.axes._axes.Axes: The modified Axes object with plotted points.
You should write self-contained code starting with:

Code

import matplotlib
import numpy as np
def task_func(ax, num_points):

code prompt

Code

import matplotlib
import numpy as np
def task_func(ax, num_points):

entry point

task_func

libs

  • numpy
  • matplotlib

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import