benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf ece8d5f0-b924-5369-862c-d8876227af40

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

# Constants
FUNCTIONS = [np.sin, np.cos, np.tan]

def task_func(ax, func_index):
    """
    Draw a mathematical function (sine, cosine, or tangent) on a polar diagram 'ax'.
    The radial ticks are placed at a position corresponding to the index of the function multiplied by 45 degrees.

    Parameters:
    ax (matplotlib.axes._axes.Axes): The ax to plot on.
    func_index (int): The index of the function in the FUNCTIONS list (0 for sine, 1 for cosine, 2 for tangent).

    Returns:
    matplotlib.axes._axes.Axes: The modified ax with the plotted function.
    
    Raises:
    - This function will raise a ValueError if the input ax is not and Axes.
    
    Requirements:
    - matplotlib
    - numpy

    Example:
    >>> import matplotlib.pyplot as plt
    >>> fig = plt.figure()
    >>> ax = fig.add_subplot(111, polar=True)
    >>> ax_up = task_func(ax, 1)
    <class 'matplotlib.projections.polar.PolarAxes'>
    >>> ax_up.lines[0].get_ydata()[0]
    1.0
    >>> plt.close()
    """

instruct prompt

Draw a mathematical function (sine, cosine, or tangent) on a polar diagram 'ax'. The radial ticks are placed at a position corresponding to the index of the function multiplied by 45 degrees.
The function should raise the exception for: This function will raise a ValueError if the input ax is not and Axes.
The function should output with:
    matplotlib.axes._axes.Axes: The modified ax with the plotted function.
You should write self-contained code starting with:

Code

import matplotlib
import numpy as np
# Constants
FUNCTIONS = [np.sin, np.cos, np.tan]
def task_func(ax, func_index):

code prompt

Code

import matplotlib
import numpy as np
# Constants
FUNCTIONS = [np.sin, np.cos, np.tan]
def task_func(ax, func_index):

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