prompt
stringlengths
105
757
reference_code
stringlengths
12
387
code_context
stringlengths
1.3k
3.36k
problem_id
int64
511
665
library_problem_id
int64
0
154
library
stringclasses
1 value
test_case_cnt
int64
1
1
perturbation_type
stringclasses
2 values
perturbation_origin_id
int64
0
154
user_chat_prompt
stringlengths
512
1.16k
test_code
stringlengths
974
2.48k
solution_function
stringlengths
212
1.29k
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Make a scatter plot with x and y and set marker size to be 100 # Combine star hatch and vertical line hatch together for the marker # SOLUTION START
plt.scatter(x, y, hatch="*|", s=500)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.scatter...
612
101
Matplotlib
1
Semantic
98
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Make a scatter plot with x and y and set marker size to be 100 - Combine star hatch and vertical line hatch together for the marker - save the figure using `pl...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.scatter...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.scatter(x, y, hatch="*|", s=500) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import matplotlib.pyplot as plt import numpy as np data = np.random.random((10, 10)) # Set xlim and ylim to be between 0 and 10 # Plot a heatmap of data in the rectangle where right is 5, left is 1, bottom is 1, and top is 4. # SOLUTION START
plt.xlim(0, 10) plt.ylim(0, 10) plt.imshow(data, extent=[1, 5, 1, 4])
import matplotlib.pyplot as plt import numpy as np from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): data = np.random.random((10, 10)) plt.xlim(0, 10) ...
613
102
Matplotlib
1
Origin
102
Given this code block: ``` import matplotlib.pyplot as plt import numpy as np data = np.random.random((10, 10)) ``` Please help me to: - Set xlim and ylim to be between 0 and 10 - Plot a heatmap of data in the rectangle where right is 5, left is 1, bottom is 1, and top is 4. - save the figure using `plt.savefig('outp...
import matplotlib.pyplot as plt import numpy as np from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): data = np.random.random((10, 10)) plt.xlim(0, 10) ...
def solve(test_input): import matplotlib.pyplot as plt import numpy as np data = np.random.random((10, 10)) plt.xlim(0, 10) plt.ylim(0, 10) plt.imshow(data, extent=[1, 5, 1, 4]) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0.1, 2 * np.pi, 41) y = np.exp(np.sin(x)) # make a stem plot of y over x and set the orientation to be horizontal # SOLUTION START
plt.stem(x, y, orientation="horizontal")
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.linspace(0.1, 2 * np.pi, 41) y = np.exp(np.sin(x)) plt.stem(...
614
103
Matplotlib
1
Origin
103
Given this code block: ``` import matplotlib.pyplot as plt import numpy as np x = np.linspace(0.1, 2 * np.pi, 41) y = np.exp(np.sin(x)) ``` Please help me to: - make a stem plot of y over x and set the orientation to be horizontal - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the s...
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.linspace(0.1, 2 * np.pi, 41) y = np.exp(np.sin(x)) plt.stem(...
def solve(test_input): import matplotlib.pyplot as plt import numpy as np x = np.linspace(0.1, 2 * np.pi, 41) y = np.exp(np.sin(x)) plt.stem(x, y, orientation="horizontal") plt.savefig('output.png', bbox_inches ='tight') result = None return result
import matplotlib.pyplot as plt d = {"a": 4, "b": 5, "c": 7} c = {"a": "red", "c": "green", "b": "blue"} # Make a bar plot using data in `d`. Use the keys as x axis labels and the values as the bar heights. # Color each bar in the plot by looking up the color in colors # SOLUTION START
colors = [] for k in d: colors.append(c[k]) plt.bar(range(len(d)), d.values(), color=colors) plt.xticks(range(len(d)), d.keys())
import matplotlib.pyplot as plt from PIL import Image import numpy as np import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): d = {"a": 4, "b": 5, "c": 7} c = {"a": "red", "c": "g...
615
104
Matplotlib
1
Origin
104
Given this code block: ``` import matplotlib.pyplot as plt d = {"a": 4, "b": 5, "c": 7} c = {"a": "red", "c": "green", "b": "blue"} ``` Please help me to: - Make a bar plot using data in `d`. Use the keys as x axis labels and the values as the bar heights. - Color each bar in the plot by looking up the color in color...
import matplotlib.pyplot as plt from PIL import Image import numpy as np import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): d = {"a": 4, "b": 5, "c": 7} c = {"a": "red", "c": "g...
def solve(test_input): import matplotlib.pyplot as plt d = {"a": 4, "b": 5, "c": 7} c = {"a": "red", "c": "green", "b": "blue"} colors = [] for k in d: colors.append(c[k]) plt.bar(range(len(d)), d.values(), color=colors) plt.xticks(range(len(d)), d.keys()) plt.savefig('out...
import matplotlib.pyplot as plt # Make a solid vertical line at x=3 and label it "cutoff". Show legend of this plot. # SOLUTION START
plt.axvline(x=3, label="cutoff") plt.legend()
import matplotlib.pyplot as plt from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): plt.axvline(x=3, label="cutoff") plt.legend() plt.savefig("ans.png"...
616
105
Matplotlib
1
Origin
105
Given this code block: ``` import matplotlib.pyplot as plt ``` Please help me to: - Make a solid vertical line at x=3 and label it "cutoff". Show legend of this plot. - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fit in a function with the following signature: ``` d...
import matplotlib.pyplot as plt from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): plt.axvline(x=3, label="cutoff") plt.legend() plt.savefig("ans.png"...
def solve(test_input): import matplotlib.pyplot as plt plt.axvline(x=3, label="cutoff") plt.legend() plt.savefig('output.png', bbox_inches ='tight') result = None return result
import matplotlib.pyplot as plt labels = ["a", "b"] height = [3, 4] # Use polar projection for the figure and make a bar plot with labels in `labels` and bar height in `height` # SOLUTION START
fig, ax = plt.subplots(subplot_kw={"projection": "polar"}) plt.bar(labels, height)
import matplotlib.pyplot as plt from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): labels = ["a", "b"] height = [3, 4] fig, ax = plt.subplots(subplot_...
617
106
Matplotlib
1
Origin
106
Given this code block: ``` import matplotlib.pyplot as plt labels = ["a", "b"] height = [3, 4] ``` Please help me to: - Use polar projection for the figure and make a bar plot with labels in `labels` and bar height in `height` - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solut...
import matplotlib.pyplot as plt from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): labels = ["a", "b"] height = [3, 4] fig, ax = plt.subplots(subplot_...
def solve(test_input): import matplotlib.pyplot as plt labels = ["a", "b"] height = [3, 4] fig, ax = plt.subplots(subplot_kw={"projection": "polar"}) plt.bar(labels, height) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import matplotlib.pyplot as plt l = ["a", "b", "c"] data = [225, 90, 50] # Make a donut plot of using `data` and use `l` for the pie labels # Set the wedge width to be 0.4 # SOLUTION START
plt.pie(data, labels=l, wedgeprops=dict(width=0.4))
import matplotlib.pyplot as plt from PIL import Image import numpy as np import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): l = ["a", "b", "c"] data = [225, 90, 50] plt.pie(...
618
107
Matplotlib
1
Origin
107
Given this code block: ``` import matplotlib.pyplot as plt l = ["a", "b", "c"] data = [225, 90, 50] ``` Please help me to: - Make a donut plot of using `data` and use `l` for the pie labels - Set the wedge width to be 0.4 - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution ...
import matplotlib.pyplot as plt from PIL import Image import numpy as np import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): l = ["a", "b", "c"] data = [225, 90, 50] plt.pie(...
def solve(test_input): import matplotlib.pyplot as plt l = ["a", "b", "c"] data = [225, 90, 50] plt.pie(data, labels=l, wedgeprops=dict(width=0.4)) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x and show blue dashed grid lines # SOLUTION START
plt.plot(y, x) plt.grid(color="blue", linestyle="dashed")
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
619
108
Matplotlib
1
Origin
108
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x and show blue dashed grid lines - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fit in a functi...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(y, x) plt.grid(color="blue", linestyle="dashed") plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x # Turn minor ticks on and show gray dashed minor grid lines # Do not show any major grid lines # SOLUTION START
plt.plot(y, x) plt.minorticks_on() plt.grid(color="gray", linestyle="dashed", which="minor")
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
620
109
Matplotlib
1
Origin
109
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x - Turn minor ticks on and show gray dashed minor grid lines - Do not show any major grid lines - save the figure using `plt.savefig('output.png'...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(y, x) plt.minorticks_on() plt.grid(color="gray", linestyle="dashed", which="minor") plt.savefig('output.png', bbox_inches ='tight') re...
import matplotlib.pyplot as plt labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45, 12, 20] colors = ["red", "blue", "green", "yellow"] # Make a pie chart with data in `sizes` and use `labels` as the pie labels and `colors` as the pie color. # Bold the pie labels # SOLUTION START
plt.pie(sizes, colors=colors, labels=labels, textprops={"weight": "bold"})
import matplotlib.pyplot as plt from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45,...
621
110
Matplotlib
1
Origin
110
Given this code block: ``` import matplotlib.pyplot as plt labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45, 12, 20] colors = ["red", "blue", "green", "yellow"] ``` Please help me to: - Make a pie chart with data in `sizes` and use `labels` as the pie labels and `colors` as the pie color. - Bold...
import matplotlib.pyplot as plt from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45,...
def solve(test_input): import matplotlib.pyplot as plt labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45, 12, 20] colors = ["red", "blue", "green", "yellow"] plt.pie(sizes, colors=colors, labels=labels, textprops={"weight": "bold"}) plt.savefig('output.png', bbox_inch...
import matplotlib.pyplot as plt labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45, 12, 20] colors = ["red", "blue", "green", "yellow"] # Make a pie chart with data in `sizes` and use `labels` as the pie labels and `colors` as the pie color. # Bold the pie labels # SOLUTION START
plt.pie(sizes, colors=colors, labels=labels, textprops={"weight": "bold"})
import matplotlib.pyplot as plt from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45,...
622
111
Matplotlib
1
Origin
111
Given this code block: ``` import matplotlib.pyplot as plt labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45, 12, 20] colors = ["red", "blue", "green", "yellow"] ``` Please help me to: - Make a pie chart with data in `sizes` and use `labels` as the pie labels and `colors` as the pie color. - Bold...
import matplotlib.pyplot as plt from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45,...
def solve(test_input): import matplotlib.pyplot as plt labels = ["Walking", "Talking", "Sleeping", "Working"] sizes = [23, 45, 12, 20] colors = ["red", "blue", "green", "yellow"] plt.pie(sizes, colors=colors, labels=labels, textprops={"weight": "bold"}) plt.savefig('output.png', bbox_inch...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x in a line chart but use transparent marker with non-transparent edge # SOLUTION START
plt.plot( x, y, "-o", ms=14, markerfacecolor="None", markeredgecolor="red", markeredgewidth=5 )
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot( ...
623
112
Matplotlib
1
Origin
112
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x in a line chart but use transparent marker with non-transparent edge - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot( ...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot( x, y, "-o", ms=14, markerfacecolor="None", markeredgecolor="red", markeredgewidth=5 ) plt.savefig('output.png', bbox_inches ='tight')...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[ ["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"] ] sns.distplot(df["bill_length_mm"], color="blue") # Plot a vertical line at 55 with green color # SOLUTION START
plt.axvline(55, color="green")
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_d...
624
113
Matplotlib
1
Origin
113
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[ ["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"] ] sns.distplot(df["bill_length_mm"], color="blue") ``` Please help me to: - Plot a verti...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_d...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[ ["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"] ] sns.distplot(df["bill_length_mm"], color="blue") ...
import matplotlib.pyplot as plt import numpy as np # Specify the values of blue bars (height) blue_bar = (23, 25, 17) # Specify the values of orange bars (height) orange_bar = (19, 18, 14) # Plot the blue bar and the orange bar side-by-side in the same bar plot. # Make sure the bars don't overlap with each other. # ...
# Position of bars on x-axis ind = np.arange(len(blue_bar)) # Figure size plt.figure(figsize=(10, 5)) # Width of a bar width = 0.3 plt.bar(ind, blue_bar, width, label="Blue bar label") plt.bar(ind + width, orange_bar, width, label="Orange bar label")
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): blue_bar = (23, 25, 17) orange_bar = (19, 18, 14) ind = np.arange(l...
625
114
Matplotlib
1
Origin
114
Given this code block: ``` import matplotlib.pyplot as plt import numpy as np blue_bar = (23, 25, 17) orange_bar = (19, 18, 14) ``` Please help me to: - Specify the values of blue bars (height) - Specify the values of orange bars (height) - Plot the blue bar and the orange bar side-by-side in the same bar plot. - M...
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): blue_bar = (23, 25, 17) orange_bar = (19, 18, 14) ind = np.arange(l...
def solve(test_input): import matplotlib.pyplot as plt import numpy as np blue_bar = (23, 25, 17) orange_bar = (19, 18, 14) # Position of bars on x-axis ind = np.arange(len(blue_bar)) # Figure size plt.figure(figsize=(10, 5)) # Width of a bar width = 0.3 plt....
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.random.rand(10) z = np.random.rand(10) a = np.arange(10) # Make two subplots # Plot y over x in the first subplot and plot z over a in the second subplot # Label each line chart and put them into a single legend on the fir...
fig, ax = plt.subplots(2, 1) (l1,) = ax[0].plot(x, y, color="red", label="y") (l2,) = ax[1].plot(a, z, color="blue", label="z") ax[0].legend([l1, l2], ["z", "y"])
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.random.rand(10) z = np...
626
115
Matplotlib
1
Origin
115
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.random.rand(10) z = np.random.rand(10) a = np.arange(10) ``` Please help me to: - Make two subplots - Plot y over x in the first subplot and plot z over a in the second subplot - Label each line...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.random.rand(10) z = np...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.random.rand(10) z = np.random.rand(10) a = np.arange(10) fig, ax = plt.subplots(2, 1) (l1,) = ax[0].plot(x, y, color="red", label="y") (l2,) = ax[1].plot(...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib x = np.arange(10) y = np.linspace(0, 1, 10) # Plot y over x with a scatter plot # Use the "Spectral" colormap and color each data point based on the y-value # SOLUTION START
plt.scatter(x, y, c=y, cmap="Spectral")
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.linspace...
627
116
Matplotlib
1
Origin
116
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib x = np.arange(10) y = np.linspace(0, 1, 10) ``` Please help me to: - Plot y over x with a scatter plot - Use the "Spectral" colormap and color each data point based on the y-value - save the figure usin...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.linspace...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib x = np.arange(10) y = np.linspace(0, 1, 10) plt.scatter(x, y, c=y, cmap="Spectral") plt.savefig('output.png', bbox_inches ='tight') result = None return res...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # plot y over x # use a tick interval of 1 on the a-axis # SOLUTION START
plt.plot(x, y) plt.xticks(np.arange(min(x), max(x) + 1, 1.0))
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
628
117
Matplotlib
1
Origin
117
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - plot y over x - use a tick interval of 1 on the a-axis - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fit i...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y) plt.xticks(np.arange(min(x), max(x) + 1, 1.0)) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[["bill_length_mm", "species", "sex"]] # Use seaborn catplot to plot multiple barplots of "bill_length_mm" over "sex" and separate into different subplot columns by "species" # Do not share y ...
sns.catplot( x="sex", col="species", y="bill_length_mm", data=df, kind="bar", sharey=False )
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_dataset("penguins")...
629
118
Matplotlib
1
Origin
118
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[["bill_length_mm", "species", "sex"]] ``` Please help me to: - Use seaborn catplot to plot multiple barplots of "bill_length_mm" over "sex" and separate into differe...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_dataset("penguins")...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[["bill_length_mm", "species", "sex"]] sns.catplot( x="sex", col="species", y="bill_length_mm", data=df, kind="bar", sharey=False ...
import matplotlib.pyplot as plt # draw a circle centered at (0.5, 0.5) with radius 0.2 # SOLUTION START
import matplotlib.pyplot as plt circle1 = plt.Circle((0.5, 0.5), 0.2) plt.gca().add_patch(circle1)
import matplotlib.pyplot as plt from PIL import Image import numpy as np import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): circle1 = plt.Circle((0.5, 0.5), 0.2) plt.gca().add_p...
630
119
Matplotlib
1
Origin
119
Given this code block: ``` import matplotlib.pyplot as plt ``` Please help me to: - draw a circle centered at (0.5, 0.5) with radius 0.2 - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fit in a function with the following signature: ``` def solve(input): # Receive...
import matplotlib.pyplot as plt from PIL import Image import numpy as np import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): circle1 = plt.Circle((0.5, 0.5), 0.2) plt.gca().add_p...
def solve(test_input): import matplotlib.pyplot as plt import matplotlib.pyplot as plt circle1 = plt.Circle((0.5, 0.5), 0.2) plt.gca().add_patch(circle1) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x and use the greek letter phi for title. Bold the title and make sure phi is bold. # SOLUTION START
plt.plot(y, x) plt.title(r"$\mathbf{\phi}$")
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
631
120
Matplotlib
1
Origin
120
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x and use the greek letter phi for title. Bold the title and make sure phi is bold. - save the figure using `plt.savefig('output.png', bbox_inches =...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(y, x) plt.title(r"$\mathbf{\phi}$") plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x with a legend of "Line" # Adjust the spacing between legend markers and labels to be 0.1 # SOLUTION START
plt.plot(x, y, label="Line") plt.legend(handletextpad=0.1)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
632
121
Matplotlib
1
Origin
121
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x with a legend of "Line" - Adjust the spacing between legend markers and labels to be 0.1 - save the figure using `plt.savefig('output.png', bbox_...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y, label="Line") plt.legend(handletextpad=0.1) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x with a legend of "Line" # Adjust the length of the legend handle to be 0.3 # SOLUTION START
plt.plot(x, y, label="Line") plt.legend(handlelength=0.3)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
633
122
Matplotlib
1
Semantic
121
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x with a legend of "Line" - Adjust the length of the legend handle to be 0.3 - save the figure using `plt.savefig('output.png', bbox_inches ='tight...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y, label="Line") plt.legend(handlelength=0.3) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y, label="Line") plt.plot(y, x, label="Flipped") # Show a two columns legend of this plot # SOLUTION START
plt.legend(ncol=2)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
634
123
Matplotlib
1
Semantic
121
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y, label="Line") plt.plot(y, x, label="Flipped") ``` Please help me to: - Show a two columns legend of this plot - save the figure using `plt.savefig('output.png', bbox_inch...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y, label="Line") plt.plot(y, x, label="Flipped") plt.legend(ncol=2) plt.savefig('output.png', bbox_inches ='tight') result = None ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y, marker="*", label="Line") # Show a legend of this plot and show two markers on the line # SOLUTION START
plt.legend(numpoints=2)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
635
124
Matplotlib
1
Semantic
121
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y, marker="*", label="Line") ``` Please help me to: - Show a legend of this plot and show two markers on the line - save the figure using `plt.savefig('output.png', bbox_inc...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y, marker="*", label="Line") plt.legend(numpoints=2) plt.savefig('output.png', bbox_inches ='tight') result = None return resu...
import matplotlib.pyplot as plt import numpy as np data = np.random.random((10, 10)) # plot the 2d matrix data with a colorbar # SOLUTION START
plt.imshow(data) plt.colorbar()
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): data = np.random.random((10, 10)) plt.imshow(data) plt.colorbar() ...
636
125
Matplotlib
1
Origin
125
Given this code block: ``` import matplotlib.pyplot as plt import numpy as np data = np.random.random((10, 10)) ``` Please help me to: - plot the 2d matrix data with a colorbar - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fit in a function with the following signat...
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): data = np.random.random((10, 10)) plt.imshow(data) plt.colorbar() ...
def solve(test_input): import matplotlib.pyplot as plt import numpy as np data = np.random.random((10, 10)) plt.imshow(data) plt.colorbar() plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x. Give the plot a title "Figure 1". bold the word "Figure" in the title but do not bold "1" # SOLUTION START
plt.plot(x, y) plt.title(r"$\bf{Figure}$ 1")
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
637
126
Matplotlib
1
Origin
126
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x. Give the plot a title "Figure 1". bold the word "Figure" in the title but do not bold "1" - save the figure using `plt.savefig('output.png', bbox...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y) plt.title(r"$\bf{Figure}$ 1") plt.savefig('output.png', bbox_inches ='tight') result = None return result
import matplotlib.pyplot as plt import seaborn as sns import pandas as pd df = pd.DataFrame( { "id": ["1", "2", "1", "2", "2"], "x": [123, 22, 356, 412, 54], "y": [120, 12, 35, 41, 45], } ) # Use seaborn to make a pairplot of data in `df` using `x` for x_vars, `y` for y_vars, and `id` ...
g = sns.pairplot(df, x_vars=["x"], y_vars=["y"], hue="id") g._legend.remove()
import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = pd.DataFrame( { ...
638
127
Matplotlib
1
Origin
127
Given this code block: ``` import matplotlib.pyplot as plt import seaborn as sns import pandas as pd df = pd.DataFrame( { "id": ["1", "2", "1", "2", "2"], "x": [123, 22, 356, 412, 54], "y": [120, 12, 35, 41, 45], } ) ``` Please help me to: - Use seaborn to make a pairplot of data in `df...
import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from PIL import Image import numpy as np def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = pd.DataFrame( { ...
def solve(test_input): import matplotlib.pyplot as plt import seaborn as sns import pandas as pd df = pd.DataFrame( { "id": ["1", "2", "1", "2", "2"], "x": [123, 22, 356, 412, 54], "y": [120, 12, 35, 41, 45], } ) g = sns.pairplot(df, x_v...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x and invert the x axis # SOLUTION START
plt.plot(x, y) plt.gca().invert_xaxis()
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
639
128
Matplotlib
1
Origin
128
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x and invert the x axis - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fit in a function with th...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y) plt.gca().invert_xaxis() plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(11) y = np.arange(11) plt.xlim(0, 10) plt.ylim(0, 10) # Plot a scatter plot x over y and set both the x limit and y limit to be between 0 and 10 # Turn off axis clipping so data points can go beyond the axes # SOLUTION START
plt.scatter(x, y, clip_on=False)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(11) y = np.arange(11) plt.xlim(0,...
640
129
Matplotlib
1
Origin
129
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(11) y = np.arange(11) plt.xlim(0, 10) plt.ylim(0, 10) ``` Please help me to: - Plot a scatter plot x over y and set both the x limit and y limit to be between 0 and 10 - Turn off axis clipping so data point...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(11) y = np.arange(11) plt.xlim(0,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(11) y = np.arange(11) plt.xlim(0, 10) plt.ylim(0, 10) plt.scatter(x, y, clip_on=False) plt.savefig('output.png', bbox_inches ='tight') result = None return ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot a scatter plot with values in x and y # Plot the data points to have red inside and have black border # SOLUTION START
plt.scatter(x, y, c="red", edgecolors="black")
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.scatter...
641
130
Matplotlib
1
Origin
130
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot a scatter plot with values in x and y - Plot the data points to have red inside and have black border - save the figure using `plt.savefig('output.png', b...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.scatter...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.scatter(x, y, c="red", edgecolors="black") plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # plot y over x on a 2 by 2 subplots with a figure size of (15, 15) # repeat the plot in each subplot # SOLUTION START
f, axs = plt.subplots(2, 2, figsize=(15, 15)) for ax in f.axes: ax.plot(x, y)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) f, axs = pl...
642
131
Matplotlib
1
Origin
131
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - plot y over x on a 2 by 2 subplots with a figure size of (15, 15) - repeat the plot in each subplot - save the figure using `plt.savefig('output.png', bbox_inc...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) f, axs = pl...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) f, axs = plt.subplots(2, 2, figsize=(15, 15)) for ax in f.axes: ax.plot(x, y) plt.savefig('output.png', bbox_inches ='tight') result = None...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.random.rand(100) * 10 # Make a histogram of x # Make the histogram range from 0 to 10 # Make bar width 2 for each bar in the histogram and have 5 bars in total # SOLUTION START
plt.hist(x, bins=np.arange(0, 11, 2))
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.random.rand(100) * 10 plt.hist(x, bins=np.ar...
643
132
Matplotlib
1
Origin
132
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.random.rand(100) * 10 ``` Please help me to: - Make a histogram of x - Make the histogram range from 0 to 10 - Make bar width 2 for each bar in the histogram and have 5 bars in total - save the figure using `plt....
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.random.rand(100) * 10 plt.hist(x, bins=np.ar...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.random.rand(100) * 10 plt.hist(x, bins=np.arange(0, 11, 2)) plt.savefig('output.png', bbox_inches ='tight') result = None return result
from matplotlib import pyplot as plt import numpy as np x = np.arange(10) y = np.arange(1, 11) error = np.random.random(y.shape) # Plot y over x and show the error according to `error` # Plot the error as a shaded region rather than error bars # SOLUTION START
plt.plot(x, y, "k-") plt.fill_between(x, y - error, y + error)
from matplotlib import pyplot as plt import numpy as np from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(1, 11) error...
644
133
Matplotlib
1
Origin
133
Given this code block: ``` from matplotlib import pyplot as plt import numpy as np x = np.arange(10) y = np.arange(1, 11) error = np.random.random(y.shape) ``` Please help me to: - Plot y over x and show the error according to `error` - Plot the error as a shaded region rather than error bars - save the figure using ...
from matplotlib import pyplot as plt import numpy as np from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(1, 11) error...
def solve(test_input): from matplotlib import pyplot as plt import numpy as np x = np.arange(10) y = np.arange(1, 11) error = np.random.random(y.shape) plt.plot(x, y, "k-") plt.fill_between(x, y - error, y + error) plt.savefig('output.png', bbox_inches ='tight') result = None ...
import matplotlib.pyplot as plt import numpy as np xvec = np.linspace(-5.0, 5.0, 100) x, y = np.meshgrid(xvec, xvec) z = -np.hypot(x, y) plt.contourf(x, y, z) # draw x=0 and y=0 axis in my contour plot with white color # SOLUTION START
plt.axhline(0, color="white") plt.axvline(0, color="white")
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): xvec = np.linspace(-5.0, 5.0, 100) x, y = np.meshgrid(xvec, xvec) z...
645
134
Matplotlib
1
Origin
134
Given this code block: ``` import matplotlib.pyplot as plt import numpy as np xvec = np.linspace(-5.0, 5.0, 100) x, y = np.meshgrid(xvec, xvec) z = -np.hypot(x, y) plt.contourf(x, y, z) ``` Please help me to: - draw x=0 and y=0 axis in my contour plot with white color - save the figure using `plt.savefig('output.png',...
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): xvec = np.linspace(-5.0, 5.0, 100) x, y = np.meshgrid(xvec, xvec) z...
def solve(test_input): import matplotlib.pyplot as plt import numpy as np xvec = np.linspace(-5.0, 5.0, 100) x, y = np.meshgrid(xvec, xvec) z = -np.hypot(x, y) plt.contourf(x, y, z) plt.axhline(0, color="white") plt.axvline(0, color="white") plt.savefig('output.png', bbox_inch...
import matplotlib.pyplot as plt import numpy as np box_position, box_height, box_errors = np.arange(4), np.ones(4), np.arange(1, 5) c = ["r", "r", "b", "b"] fig, ax = plt.subplots() ax.bar(box_position, box_height, color="yellow") # Plot error bars with errors specified in box_errors. Use colors in c to color the err...
for pos, y, err, color in zip(box_position, box_height, box_errors, c): ax.errorbar(pos, y, err, color=color)
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): box_position, box_height, box_errors = np.arange(4), np.ones(4), np.arange(...
646
135
Matplotlib
1
Origin
135
Given this code block: ``` import matplotlib.pyplot as plt import numpy as np box_position, box_height, box_errors = np.arange(4), np.ones(4), np.arange(1, 5) c = ["r", "r", "b", "b"] fig, ax = plt.subplots() ax.bar(box_position, box_height, color="yellow") ``` Please help me to: - Plot error bars with errors specifie...
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): box_position, box_height, box_errors = np.arange(4), np.ones(4), np.arange(...
def solve(test_input): import matplotlib.pyplot as plt import numpy as np box_position, box_height, box_errors = np.arange(4), np.ones(4), np.arange(1, 5) c = ["r", "r", "b", "b"] fig, ax = plt.subplots() ax.bar(box_position, box_height, color="yellow") for pos, y, err, color in zip(b...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) z = np.arange(10) a = np.arange(10) # Plot y over x and z over a in two side-by-side subplots # Make "Y" the title of the first subplot and "Z" the title of the second subplot # Raise the title of the second sub...
fig, (ax1, ax2) = plt.subplots(1, 2, sharey=True) ax1.plot(x, y) ax1.set_title("Y") ax2.plot(a, z) ax2.set_title("Z", y=1.08)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) z = np.aran...
647
136
Matplotlib
1
Origin
136
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) z = np.arange(10) a = np.arange(10) ``` Please help me to: - Plot y over x and z over a in two side-by-side subplots - Make "Y" the title of the first subplot and "Z" the title of the ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) z = np.aran...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) z = np.arange(10) a = np.arange(10) fig, (ax1, ax2) = plt.subplots(1, 2, sharey=True) ax1.plot(x, y) ax1.set_title("Y") ax2.plot(a, z) ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # make 4 by 4 subplots with a figure size (5,5) # in each subplot, plot y over x and show axis tick labels # give enough spacing between subplots so the tick labels don't overlap # SOLUTION START
fig, axes = plt.subplots(nrows=4, ncols=4, figsize=(5, 5)) for ax in axes.flatten(): ax.plot(x, y) fig.tight_layout()
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) fig, axes =...
648
137
Matplotlib
1
Origin
137
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - make 4 by 4 subplots with a figure size (5,5) - in each subplot, plot y over x and show axis tick labels - give enough spacing between subplots so the tick la...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) fig, axes =...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) fig, axes = plt.subplots(nrows=4, ncols=4, figsize=(5, 5)) for ax in axes.flatten(): ax.plot(x, y) fig.tight_layout() plt.savefig('output.p...
import matplotlib.pyplot as plt import numpy as np d = np.random.random((10, 10)) # Use matshow to plot d and make the figure size (8, 8) # SOLUTION START
matfig = plt.figure(figsize=(8, 8)) plt.matshow(d, fignum=matfig.number)
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): d = np.random.random((10, 10)) matfig = plt.figure(figsize=(8, 8)) ...
649
138
Matplotlib
1
Origin
138
Given this code block: ``` import matplotlib.pyplot as plt import numpy as np d = np.random.random((10, 10)) ``` Please help me to: - Use matshow to plot d and make the figure size (8, 8) - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fit in a function with the follo...
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): d = np.random.random((10, 10)) matfig = plt.figure(figsize=(8, 8)) ...
def solve(test_input): import matplotlib.pyplot as plt import numpy as np d = np.random.random((10, 10)) matfig = plt.figure(figsize=(8, 8)) plt.matshow(d, fignum=matfig.number) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[ ["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"] ].head(10) # Plot df as a matplotlib table. Set the bbox of the table to [0, 0, 1, 1] # SOLUTION START
bbox = [0, 0, 1, 1] plt.table(cellText=df.values, rowLabels=df.index, bbox=bbox, colLabels=df.columns)
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_d...
650
139
Matplotlib
1
Origin
139
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[ ["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"] ].head(10) ``` Please help me to: - Plot df as a matplotlib table. Set the bbox of the t...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_d...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[ ["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"] ].head(10) bbox = [0, 0, 1, 1] plt.table(cellText=...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x in a line chart. Show x axis tick labels on both top and bottom of the figure. # SOLUTION START
plt.plot(x, y) plt.tick_params(labeltop=True)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
651
140
Matplotlib
1
Origin
140
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x in a line chart. Show x axis tick labels on both top and bottom of the figure. - save the figure using `plt.savefig('output.png', bbox_inches ='ti...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y) plt.tick_params(labeltop=True) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x in a line chart. Show x axis ticks on both top and bottom of the figure. # SOLUTION START
plt.plot(x, y) plt.tick_params(top=True)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
652
141
Matplotlib
1
Semantic
140
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x in a line chart. Show x axis ticks on both top and bottom of the figure. - save the figure using `plt.savefig('output.png', bbox_inches ='tight')`...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y) plt.tick_params(top=True) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x in a line chart. Show x axis tick labels but hide the x axis ticks # SOLUTION START
plt.plot(x, y) plt.tick_params(bottom=False, labelbottom=True)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
653
142
Matplotlib
1
Semantic
140
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x in a line chart. Show x axis tick labels but hide the x axis ticks - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I n...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(x,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(x, y) plt.tick_params(bottom=False, labelbottom=True) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") # Make catplots of scatter plots by using "time" as x, "pulse" as y, "kind" as hue, and "diet" as col # Change the subplots titles to "Group: Fat" and "Group: No Fat" # SOLUTION START
g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=df) axs = g.axes.flatten() axs[0].set_title("Group: Fat") axs[1].set_title("Group: No Fat")
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_d...
654
143
Matplotlib
1
Origin
143
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") ``` Please help me to: - Make catplots of scatter plots by using "time" as x, "pulse" as y, "kind" as hue, and "diet" as col - Change the subplots titles to "Group:...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image import matplotlib def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_d...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=df) axs = g.axes.flatten() axs[0].set_title("Group: Fat") axs...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") # Make catplots of scatter plots by using "time" as x, "pulse" as y, "kind" as hue, and "diet" as col # Change the xlabels to "Exercise Time" and "Exercise Time" # SOLUTION START
g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=df) axs = g.axes.flatten() axs[0].set_xlabel("Exercise Time") axs[1].set_xlabel("Exercise Time")
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_dataset("exercise")...
655
144
Matplotlib
1
Semantic
143
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") ``` Please help me to: - Make catplots of scatter plots by using "time" as x, "pulse" as y, "kind" as hue, and "diet" as col - Change the xlabels to "Exercise Time"...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_dataset("exercise")...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=df) axs = g.axes.flatten() axs[0].set_xlabel("Exercise Time") ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") # Make catplots of scatter plots by using "time" as x, "pulse" as y, "kind" as hue, and "diet" as col # Do not show any ylabel on either subplot # SOLUTION START
g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=df) axs = g.axes.flatten() axs[0].set_ylabel("")
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_dataset("exercise")...
656
145
Matplotlib
1
Semantic
143
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") ``` Please help me to: - Make catplots of scatter plots by using "time" as x, "pulse" as y, "kind" as hue, and "diet" as col - Do not show any ylabel on either subp...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_dataset("exercise")...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("exercise") g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=df) axs = g.axes.flatten() axs[0].set_ylabel("") plt.savefig(...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # plot y over x with label "y" # make the legend fontsize 8 # SOLUTION START
plt.plot(y, x, label="y") plt.legend(fontsize=8)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
657
146
Matplotlib
1
Origin
146
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - plot y over x with label "y" - make the legend fontsize 8 - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fi...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(y, x, label="y") plt.legend(fontsize=8) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x with figsize (5, 5) and dpi 300 # SOLUTION START
plt.figure(figsize=(5, 5), dpi=300) plt.plot(y, x)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.figure(...
658
147
Matplotlib
1
Origin
147
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x with figsize (5, 5) and dpi 300 - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I need the solution to fit in a functi...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.figure(...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.figure(figsize=(5, 5), dpi=300) plt.plot(y, x) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x with label "y" and show legend # Remove the border of frame of legend # SOLUTION START
plt.plot(y, x, label="y") plt.legend(frameon=False)
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
659
148
Matplotlib
1
Origin
148
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x with label "y" and show legend - Remove the border of frame of legend - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) plt.plot(y,...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) plt.plot(y, x, label="y") plt.legend(frameon=False) plt.savefig('output.png', bbox_inches ='tight') result = None return result
import numpy as np import math import matplotlib import matplotlib.pyplot as plt t = np.linspace(0, 2 * math.pi, 400) a = np.sin(t) b = np.cos(t) c = a + b # Plot a, b, c in the same figure # SOLUTION START
plt.plot(t, a, t, b, t, c)
import numpy as np import math import matplotlib import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): t = np.linspace(0, 2 * math.pi, 400) a = ...
660
149
Matplotlib
1
Origin
149
Given this code block: ``` import numpy as np import math import matplotlib import matplotlib.pyplot as plt t = np.linspace(0, 2 * math.pi, 400) a = np.sin(t) b = np.cos(t) c = a + b ``` Please help me to: - Plot a, b, c in the same figure - save the figure using `plt.savefig('output.png', bbox_inches ='tight')` I n...
import numpy as np import math import matplotlib import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): t = np.linspace(0, 2 * math.pi, 400) a = ...
def solve(test_input): import numpy as np import math import matplotlib import matplotlib.pyplot as plt t = np.linspace(0, 2 * math.pi, 400) a = np.sin(t) b = np.cos(t) c = a + b plt.plot(t, a, t, b, t, c) plt.savefig('output.png', bbox_inches ='tight') result = None ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[["bill_length_mm", "species", "sex"]] # Make a stripplot for the data in df. Use "sex" as x, "bill_length_mm" as y, and "species" for the color # Remove the legend from the stripplot # SOLUTI...
ax = sns.stripplot(x="sex", y="bill_length_mm", hue="species", data=df) ax.legend_.remove()
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_dataset("penguins")...
661
150
Matplotlib
1
Origin
150
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[["bill_length_mm", "species", "sex"]] ``` Please help me to: - Make a stripplot for the data in df. Use "sex" as x, "bill_length_mm" as y, and "species" for the colo...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = sns.load_dataset("penguins")...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = sns.load_dataset("penguins")[["bill_length_mm", "species", "sex"]] ax = sns.stripplot(x="sex", y="bill_length_mm", hue="species", data=df) ax.legend_.remove() p...
import seaborn as sns import matplotlib.pylab as plt import pandas import numpy as np df = pandas.DataFrame( { "a": np.arange(1, 31), "b": ["A",] * 10 + ["B",] * 10 + ["C",] * 10, "c": np.random.rand(30), } ) # Use seaborn FaceGrid for rows in "b" and plot seaborn pointplots of "c" ove...
g = sns.FacetGrid(df, row="b") g.map(sns.pointplot, "a", "c") for ax in g.axes.flat: labels = ax.get_xticklabels() # get x labels for i, l in enumerate(labels): if i % 2 == 0: labels[i] = "" # skip even labels ax.set_xticklabels(labels) # set new labels
import seaborn as sns import matplotlib.pylab as plt import pandas import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = pandas.DataFrame( { ...
662
151
Matplotlib
1
Origin
151
Given this code block: ``` import seaborn as sns import matplotlib.pylab as plt import pandas import numpy as np df = pandas.DataFrame( { "a": np.arange(1, 31), "b": ["A",] * 10 + ["B",] * 10 + ["C",] * 10, "c": np.random.rand(30), } ) ``` Please help me to: - Use seaborn FaceGrid for r...
import seaborn as sns import matplotlib.pylab as plt import pandas import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): df = pandas.DataFrame( { ...
def solve(test_input): import seaborn as sns import matplotlib.pylab as plt import pandas import numpy as np df = pandas.DataFrame( { "a": np.arange(1, 31), "b": ["A",] * 10 + ["B",] * 10 + ["C",] * 10, "c": np.random.rand(30), } ) g...
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np x = np.random.random(10) y = np.random.random(10) z = np.random.random(10) # Make a 3D scatter plot of x,y,z # change the view of the plot to have 100 azimuth and 50 elevation # SOLUTION START
fig = plt.figure() ax = fig.add_subplot(111, projection="3d") ax.scatter(x, y, z) ax.azim = 100 ax.elev = 50
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.random.random(10) y = np.random.random(10) z = np.random.ran...
663
152
Matplotlib
1
Origin
152
Given this code block: ``` import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np x = np.random.random(10) y = np.random.random(10) z = np.random.random(10) ``` Please help me to: - Make a 3D scatter plot of x,y,z - change the view of the plot to have 100 azimuth and 50 elevation -...
import matplotlib.pyplot as plt import numpy as np from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.random.random(10) y = np.random.random(10) z = np.random.ran...
def solve(test_input): import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np x = np.random.random(10) y = np.random.random(10) z = np.random.random(10) fig = plt.figure() ax = fig.add_subplot(111, projection="3d") ax.scatter(x, y, z) ax...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) # Plot y over x in a line chart and name axis with labels ("x" and "y") # Hide tick labels but keep axis labels # SOLUTION START
fig, ax = plt.subplots() ax.plot(x, y) ax.set_xticklabels([]) ax.set_yticklabels([]) ax.set_xlabel("x") ax.set_ylabel("y")
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) fig, ax = p...
664
153
Matplotlib
1
Origin
153
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) ``` Please help me to: - Plot y over x in a line chart and name axis with labels ("x" and "y") - Hide tick labels but keep axis labels - save the figure using `plt.savefig('output.png'...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.arange(10) y = np.arange(10) fig, ax = p...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) fig, ax = plt.subplots() ax.plot(x, y) ax.set_xticklabels([]) ax.set_yticklabels([]) ax.set_xlabel("x") ax.set_ylabel("y") plt.savefig(...
import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.random.random((10, 10)) from matplotlib import gridspec nrow = 2 ncol = 2 fig = plt.figure(figsize=(ncol + 1, nrow + 1)) # Make a 2x2 subplots with fig and plot x in each subplot as an image # Remove the space between each subplot and mak...
gs = gridspec.GridSpec( nrow, ncol, wspace=0.0, hspace=0.0, top=1.0 - 0.5 / (nrow + 1), bottom=0.5 / (nrow + 1), left=0.5 / (ncol + 1), right=1 - 0.5 / (ncol + 1), ) for i in range(nrow): for j in range(ncol): ax = plt.subplot(gs[i, j]) ax.imshow(x) ax.set_xt...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import gridspec from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.random.random((1...
665
154
Matplotlib
1
Origin
154
Given this code block: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.random.random((10, 10)) from matplotlib import gridspec nrow = 2 ncol = 2 fig = plt.figure(figsize=(ncol + 1, nrow + 1)) ``` Please help me to: - Make a 2x2 subplots with fig and plot x in each subplot as an image ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import gridspec from PIL import Image def skip_plt_cmds(l): return all( p not in l for p in ["plt.show()", "plt.clf()", "plt.close()", "savefig"] ) def generate_test_case(test_case_id): x = np.random.random((1...
def solve(test_input): import numpy as np import pandas as pd import matplotlib.pyplot as plt x = np.random.random((10, 10)) from matplotlib import gridspec nrow = 2 ncol = 2 fig = plt.figure(figsize=(ncol + 1, nrow + 1)) gs = gridspec.GridSpec( nrow, ncol, ...