uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ae166084bc53a4eed1f2e191 | train | function | def test_bar_uint8():
xs = [0, 1, 2, 3]
b = plt.bar(np.array(xs, dtype=np.uint8), [2, 3, 4, 5], align="edge")
for (patch, x) in zip(b.patches, xs):
assert patch.xy[0] == x
| def test_bar_uint8():
| xs = [0, 1, 2, 3]
b = plt.bar(np.array(xs, dtype=np.uint8), [2, 3, 4, 5], align="edge")
for (patch, x) in zip(b.patches, xs):
assert patch.xy[0] == x
| False
assert ax.xaxis.minorTicks[0].label2.get_visible() is True
def test_none_kwargs():
ax = plt.figure().subplots()
ln, = ax.plot(range(32), linestyle=None)
assert ln.get_linestyle() == '-'
def test_bar_uint8():
| 64 | 64 | 76 | 6 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_uint8 | test_bar_uint8 | 5,923 | 5,927 | 5,923 | 5,923 | 7165223fadb6dfc92650882977b2f0321cd4dc8f | bigcode/the-stack | train |
2d81f78c312761419047495a | train | function | def test_axes_tick_params_xlabelside():
# Tests fix for issue 10267
ax = plt.subplot()
ax.tick_params(labeltop=True, labelbottom=False,
which='major')
ax.tick_params(labeltop=True, labelbottom=False,
which='minor')
# expects top True, bottom False
# ... | def test_axes_tick_params_xlabelside():
# Tests fix for issue 10267
| ax = plt.subplot()
ax.tick_params(labeltop=True, labelbottom=False,
which='major')
ax.tick_params(labeltop=True, labelbottom=False,
which='minor')
# expects top True, bottom False
# label1.get_visible() mapped to labelbottom
# label2.get_visible() map... | label2.get_visible() is True
assert ax.yaxis.minorTicks[0].label1.get_visible() is False
assert ax.yaxis.minorTicks[0].label2.get_visible() is True
def test_axes_tick_params_xlabelside():
# Tests fix for issue 10267
| 64 | 64 | 165 | 18 | 45 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axes_tick_params_xlabelside | test_axes_tick_params_xlabelside | 5,901 | 5,914 | 5,901 | 5,902 | ba56a070c180fb31dff638889830ca79b6234829 | bigcode/the-stack | train |
6bea8cc915ed3d187455110a | train | function | def test_errorbar_shape():
fig = plt.figure()
ax = fig.gca()
x = np.arange(0.1, 4, 0.5)
y = np.exp(-x)
yerr1 = 0.1 + 0.2*np.sqrt(x)
yerr = np.vstack((yerr1, 2*yerr1)).T
xerr = 0.1 + yerr
with pytest.raises(ValueError):
ax.errorbar(x, y, yerr=yerr, fmt='o')
with ... | def test_errorbar_shape():
| fig = plt.figure()
ax = fig.gca()
x = np.arange(0.1, 4, 0.5)
y = np.exp(-x)
yerr1 = 0.1 + 0.2*np.sqrt(x)
yerr = np.vstack((yerr1, 2*yerr1)).T
xerr = 0.1 + yerr
with pytest.raises(ValueError):
ax.errorbar(x, y, yerr=yerr, fmt='o')
with pytest.raises(ValueError):
... | yi * 0.25), linestyle='-',
marker='o', ecolor='black')
axr.errorbar(x, yi, yerr=(yi * 0.25), linestyle='-',
marker='o', color=color, ecolor='black')
def test_errorbar_shape():
| 63 | 64 | 171 | 6 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_errorbar_shape | test_errorbar_shape | 3,386 | 3,401 | 3,386 | 3,386 | 5daf0886c7beb1ffcf9cc4d1ffd18b35b8900fbb | bigcode/the-stack | train |
82e9331ceef73c5aef509265 | train | function | @check_figures_equal(extensions=["png"])
def test_polar_interpolation_steps_variable_r(fig_test, fig_ref):
l, = fig_test.add_subplot(projection="polar").plot([0, np.pi/2], [1, 2])
l.get_path()._interpolation_steps = 100
fig_ref.add_subplot(projection="polar").plot(
np.linspace(0, np.pi/2, 101),... | @check_figures_equal(extensions=["png"])
def test_polar_interpolation_steps_variable_r(fig_test, fig_ref):
| l, = fig_test.add_subplot(projection="polar").plot([0, np.pi/2], [1, 2])
l.get_path()._interpolation_steps = 100
fig_ref.add_subplot(projection="polar").plot(
np.linspace(0, np.pi/2, 101), np.linspace(1, 2, 101))
| auto=auto)
assert post_auto == get_autoscale_on()
fig.canvas.draw()
assert_array_equal(get_lim(), (-0.5, 0.5))
@check_figures_equal(extensions=["png"])
def test_polar_interpolation_steps_variable_r(fig_test, fig_ref):
| 63 | 64 | 104 | 26 | 37 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_polar_interpolation_steps_variable_r | test_polar_interpolation_steps_variable_r | 6,943 | 6,948 | 6,943 | 6,944 | df6ae279c29ecc532623290022f824b52c6a4f9f | bigcode/the-stack | train |
7a87cd0ef257f63c452e3b90 | train | function | def test_empty_eventplot():
fig, ax = plt.subplots(1, 1)
ax.eventplot([[]], colors=[(0.0, 0.0, 0.0, 0.0)])
plt.draw()
| def test_empty_eventplot():
| fig, ax = plt.subplots(1, 1)
ax.eventplot([[]], colors=[(0.0, 0.0, 0.0, 0.0)])
plt.draw()
| ],
linestyles=['solid', 'dashed'],
linestyle=['dashdot', 'dotted'])
assert len(recwarn) == 3
assert all(issubclass(wi.category, MatplotlibDeprecationWarning)
for wi in recwarn)
def test_empty_eventplot():
| 64 | 64 | 53 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_empty_eventplot | test_empty_eventplot | 4,103 | 4,106 | 4,103 | 4,103 | e835f97d3a6fff27c78027cd24bb96d55574e61e | bigcode/the-stack | train |
23ec8f8a6ef4c05c7cf4e44a | train | function | def test_boxplot_bad_medians():
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig, ax = plt.subplots()
with pytest.raises(ValueError):
ax.boxplot(x, usermedians=[1, 2])
with pytest.raises(ValueError):
ax.boxplot([x, x], usermedians=[[1, 2], [1, 2]])
| def test_boxplot_bad_medians():
| x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig, ax = plt.subplots()
with pytest.raises(ValueError):
ax.boxplot(x, usermedians=[1, 2])
with pytest.raises(ValueError):
ax.boxplot([x, x], usermedians=[[1, 2], [1, 2]])
| 1400, 960],
dtype=np.float64)
ax1 = plt.axes()
ax1.boxplot(x)
ax1.set_yscale('log')
ax1.yaxis.grid(False, which='minor')
ax1.xaxis.grid(False)
def test_boxplot_bad_medians():
| 64 | 64 | 98 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_bad_medians | test_boxplot_bad_medians | 2,999 | 3,006 | 2,999 | 2,999 | fff00c99f985cdee2c1cec3d7e371298a8c13fbd | bigcode/the-stack | train |
5308d9c9e43d39d373ec4647 | train | function | @mpl.style.context('default')
def test_axes_margins():
fig, ax = plt.subplots()
ax.plot([0, 1, 2, 3])
assert ax.get_ybound()[0] != 0
fig, ax = plt.subplots()
ax.bar([0, 1, 2, 3], [1, 1, 1, 1])
assert ax.get_ybound()[0] == 0
fig, ax = plt.subplots()
ax.barh([0, 1, 2, 3], [1, ... | @mpl.style.context('default')
def test_axes_margins():
| fig, ax = plt.subplots()
ax.plot([0, 1, 2, 3])
assert ax.get_ybound()[0] != 0
fig, ax = plt.subplots()
ax.bar([0, 1, 2, 3], [1, 1, 1, 1])
assert ax.get_ybound()[0] == 0
fig, ax = plt.subplots()
ax.barh([0, 1, 2, 3], [1, 1, 1, 1])
assert ax.get_xbound()[0] == 0
fig,... | 3, lw=2, nonpositive=mcx)
else:
ax.loglog(x, y**3, lw=2)
else:
ax.loglog(x, y**3, lw=2)
if mcx:
ax.set_xscale("log", nonpositive=mcx)
if mcy:
ax.set_yscale("log", nonpositive=mcy)
@mpl.style.context('default'... | 98 | 98 | 328 | 14 | 84 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axes_margins | test_axes_margins | 5,648 | 5,679 | 5,648 | 5,649 | 47803027cfe13ca617781e46d7a3446c9acbb038 | bigcode/the-stack | train |
daf0a557ce8530f66527b44a | train | function | @image_comparison(['arc_angles.png'], remove_text=True, style='default')
def test_arc_angles():
# Ellipse parameters
w = 2
h = 1
centre = (0.2, 0.5)
scale = 2
fig, axs = plt.subplots(3, 3)
for i, ax in enumerate(axs.flat):
theta2 = i * 360 / 9
theta1 = theta2 - 45... | @image_comparison(['arc_angles.png'], remove_text=True, style='default')
def test_arc_angles():
# Ellipse parameters
| w = 2
h = 1
centre = (0.2, 0.5)
scale = 2
fig, axs = plt.subplots(3, 3)
for i, ax in enumerate(axs.flat):
theta2 = i * 360 / 9
theta1 = theta2 - 45
ax.add_patch(mpatches.Ellipse(centre, w, h, alpha=0.3))
ax.add_patch(mpatches.Arc(centre, w, h, theta1=... | y[:-1] + np.diff(y) / 2
# this is same as nearest:
ax.pcolormesh(x2, y2, Z, snap=snap)
@image_comparison(['canonical'])
def test_canonical():
fig, ax = plt.subplots()
ax.plot([1, 2, 3])
@image_comparison(['arc_angles.png'], remove_text=True, style='default')
def test_arc_angles():
# Ell... | 99 | 100 | 335 | 28 | 71 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_arc_angles | test_arc_angles | 1,277 | 1,308 | 1,277 | 1,279 | 6e6ba34f77066205df821c053a0917fa27535bb6 | bigcode/the-stack | train |
1e2d42d3ba948ea9901b526e | train | function | @image_comparison(["autoscale_tiny_range"], remove_text=True)
def test_autoscale_tiny_range():
# github pull #904
fig, axs = plt.subplots(2, 2)
for i, ax in enumerate(axs.flat):
y1 = 10**(-11 - i)
ax.plot([0, 1], [1, 1 + y1])
| @image_comparison(["autoscale_tiny_range"], remove_text=True)
def test_autoscale_tiny_range():
# github pull #904
| fig, axs = plt.subplots(2, 2)
for i, ax in enumerate(axs.flat):
y1 = 10**(-11 - i)
ax.plot([0, 1], [1, 1 + y1])
| ])
ax_ref = fig_ref.subplots()
ax_ref.plot([0, 1], [0, 1])
ax_ref.minorticks_on()
@image_comparison(["autoscale_tiny_range"], remove_text=True)
def test_autoscale_tiny_range():
# github pull #904
| 64 | 64 | 85 | 31 | 33 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_autoscale_tiny_range | test_autoscale_tiny_range | 451 | 457 | 451 | 453 | b00fce5e16c4a96c673e4dbbb3a14fbae0702fb1 | bigcode/the-stack | train |
2817fd5db99aa08e09959ac2 | train | function | @image_comparison(['hist_step.png'], remove_text=True)
def test_hist_step():
# make some data
d1 = np.linspace(1, 3, 20)
fig, ax = plt.subplots()
ax.hist(d1, histtype="step")
ax.set_ylim(0, 10)
ax.set_xlim(-1, 5)
| @image_comparison(['hist_step.png'], remove_text=True)
def test_hist_step():
# make some data
| d1 = np.linspace(1, 3, 20)
fig, ax = plt.subplots()
ax.hist(d1, histtype="step")
ax.set_ylim(0, 10)
ax.set_xlim(-1, 5)
| = np.linspace(1, 3, 20)
fig, ax = plt.subplots()
ax.hist(d1, bottom=5)
ax.hist(d2, bottom=15)
@image_comparison(['hist_step.png'], remove_text=True)
def test_hist_step():
# make some data
| 64 | 64 | 78 | 24 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_step | test_hist_step | 3,592 | 3,599 | 3,592 | 3,594 | ee31511d6eaa14cddec286026623db4256e170a5 | bigcode/the-stack | train |
e15e7e07f4a41f3861c1500a | train | function | def test_pandas_indexing_hist(pd):
ser_1 = pd.Series(data=[1, 2, 2, 3, 3, 4, 4, 4, 4, 5])
ser_2 = ser_1.iloc[1:]
fig, ax = plt.subplots()
ax.hist(ser_2)
| def test_pandas_indexing_hist(pd):
| ser_1 = pd.Series(data=[1, 2, 2, 3, 3, 4, 4, 4, 4, 5])
ser_2 = ser_1.iloc[1:]
fig, ax = plt.subplots()
ax.hist(ser_2)
| andas_index_shape(pd):
df = pd.DataFrame({"XX": [4, 5, 6], "YY": [7, 1, 2]})
fig, ax = plt.subplots()
ax.plot(df.index, df['YY'])
def test_pandas_indexing_hist(pd):
| 63 | 64 | 76 | 9 | 54 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pandas_indexing_hist | test_pandas_indexing_hist | 5,824 | 5,828 | 5,824 | 5,824 | 17474f790a7c6a95dcd45b284a5777ff43f019f2 | bigcode/the-stack | train |
a16b5ee3bd6320be10af8ce0 | train | function | def test_hist_stacked_stepfilled_bottom_geometry():
bins = [0, 1, 2, 3]
data_1 = [0, 0, 1, 1, 1, 2]
data_2 = [0, 1, 2]
_, _, patches = plt.hist([data_1, data_2],
bins=bins,
stacked=True,
bottom=[1, 2, 1.5],
... | def test_hist_stacked_stepfilled_bottom_geometry():
| bins = [0, 1, 2, 3]
data_1 = [0, 0, 1, 1, 1, 2]
data_2 = [0, 1, 2]
_, _, patches = plt.hist([data_1, data_2],
bins=bins,
stacked=True,
bottom=[1, 2, 1.5],
histtype='stepfilled')
... | 1], [3, 0]]
assert_array_equal(polygon.get_xy(), xy)
polygon, = patches[1]
xy = [[0, 2], [0, 3], [1, 3], [1, 4], [2, 4], [2, 2], [3, 2], [3, 1]]
assert_array_equal(polygon.get_xy(), xy)
def test_hist_stacked_stepfilled_bottom_geometry():
| 101 | 101 | 337 | 10 | 91 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stacked_stepfilled_bottom_geometry | test_hist_stacked_stepfilled_bottom_geometry | 3,791 | 3,811 | 3,791 | 3,791 | 7a17ecd49aea66369f7a85e0b9c60bfd9ecb771e | bigcode/the-stack | train |
90ce2b73c6979d1c008fddfe | train | function | def test_secondary_minorloc():
fig, ax = plt.subplots(figsize=(10, 5))
ax.plot(np.arange(2, 11), np.arange(2, 11))
def invert(x):
with np.errstate(divide='ignore'):
return 1 / x
secax = ax.secondary_xaxis('top', functions=(invert, invert))
assert isinstance(secax._axis... | def test_secondary_minorloc():
| fig, ax = plt.subplots(figsize=(10, 5))
ax.plot(np.arange(2, 11), np.arange(2, 11))
def invert(x):
with np.errstate(divide='ignore'):
return 1 / x
secax = ax.secondary_xaxis('top', functions=(invert, invert))
assert isinstance(secax._axis.get_minor_locator(),
... | axis('top', functions=(invert, invert))
fig.canvas.draw()
fig.set_size_inches((7, 4))
assert_allclose(ax.get_position().extents, [0.125, 0.1, 0.9, 0.9])
def test_secondary_minorloc():
| 63 | 64 | 179 | 6 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_secondary_minorloc | test_secondary_minorloc | 6,481 | 6,502 | 6,481 | 6,481 | fa89387162a1dc38884a0c8d092da891113189a9 | bigcode/the-stack | train |
329164feb82a5f649c8575ee | train | function | def test_redraw_in_frame():
fig, ax = plt.subplots(1, 1)
ax.plot([1, 2, 3])
fig.canvas.draw()
ax.redraw_in_frame()
| def test_redraw_in_frame():
| fig, ax = plt.subplots(1, 1)
ax.plot([1, 2, 3])
fig.canvas.draw()
ax.redraw_in_frame()
| =True)
fig.canvas.draw()
renderer = fig.canvas.get_renderer()
sizes = []
for ax in axs.flat:
bb = ax.get_window_extent(renderer)
sizes.extend([bb.width, bb.height])
assert_allclose(sizes, sizes[0])
def test_redraw_in_frame():
| 63 | 64 | 44 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_redraw_in_frame | test_redraw_in_frame | 6,892 | 6,896 | 6,892 | 6,892 | 9a7e34e8a67ce5e670108f5f343dc58d502f831d | bigcode/the-stack | train |
9a98c0fc8cae99eee6b02c8b | train | function | @image_comparison(['hist_step_empty.png'], remove_text=True)
def test_hist_step_empty():
# From #3886: creating hist from empty dataset raises ValueError
ax = plt.gca()
ax.hist([], histtype='step')
| @image_comparison(['hist_step_empty.png'], remove_text=True)
def test_hist_step_empty():
# From #3886: creating hist from empty dataset raises ValueError
| ax = plt.gca()
ax.hist([], histtype='step')
| 6: creating hist from empty dataset raises ValueError
ax = plt.gca()
ax.hist([], histtype='bar')
@image_comparison(['hist_step_empty.png'], remove_text=True)
def test_hist_step_empty():
# From #3886: creating hist from empty dataset raises ValueError
| 63 | 64 | 52 | 36 | 27 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_step_empty | test_hist_step_empty | 1,777 | 1,781 | 1,777 | 1,779 | 3009dada2e6a18622728d30a6698ae8a03b02a36 | bigcode/the-stack | train |
a4231f98d0cc8dd944356107 | train | function | @image_comparison(['contour_hatching'], remove_text=True, style='mpl20')
def test_contour_hatching():
x, y, z = contour_dat()
fig, ax = plt.subplots()
ax.contourf(x, y, z, 7, hatches=['/', '\\', '//', '-'],
cmap=plt.get_cmap('gray'),
extend='both', alpha=0.5)
| @image_comparison(['contour_hatching'], remove_text=True, style='mpl20')
def test_contour_hatching():
| x, y, z = contour_dat()
fig, ax = plt.subplots()
ax.contourf(x, y, z, 7, hatches=['/', '\\', '//', '-'],
cmap=plt.get_cmap('gray'),
extend='both', alpha=0.5)
| y = np.linspace(-3, 5, 120)
z = np.cos(x) + np.sin(y[:, np.newaxis])
return x, y, z
@image_comparison(['contour_hatching'], remove_text=True, style='mpl20')
def test_contour_hatching():
| 64 | 64 | 89 | 26 | 37 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_contour_hatching | test_contour_hatching | 2,055 | 2,061 | 2,055 | 2,056 | ae67fbac75dacc83360f7994beb8b84d2124139a | bigcode/the-stack | train |
8c83739c7a5de0e55e90ac31 | train | function | @image_comparison(['boxplot', 'boxplot'], tol=1.28, style='default')
def test_boxplot():
# Randomness used for bootstrapping.
np.random.seed(937)
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig, ax = plt.subplots()
ax.boxplot([x, x], bootstrap=10000, notch=1)
ax.set_y... | @image_comparison(['boxplot', 'boxplot'], tol=1.28, style='default')
def test_boxplot():
# Randomness used for bootstrapping.
| np.random.seed(937)
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig, ax = plt.subplots()
ax.boxplot([x, x], bootstrap=10000, notch=1)
ax.set_ylim((-30, 30))
# Reuse testcase from above for a labeled data test
data = {"x": [x, x]}
fig, ax = plt.subplots()
... | ():
with pytest.raises(ValueError):
_bxp_test_helper(bxp_kwargs=dict(positions=[2, 3]))
@image_comparison(['boxplot', 'boxplot'], tol=1.28, style='default')
def test_boxplot():
# Randomness used for bootstrapping.
| 63 | 64 | 170 | 37 | 26 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot | test_boxplot | 2,829 | 2,845 | 2,829 | 2,831 | 34b6b65dc3116fa38d5328a7fc9642749beb0167 | bigcode/the-stack | train |
fd4320f9272a7eef3bb31fef | train | function | @check_figures_equal(extensions=["png"])
def test_hist_log_2(fig_test, fig_ref):
axs_test = fig_test.subplots(2, 3)
axs_ref = fig_ref.subplots(2, 3)
for i, histtype in enumerate(["bar", "step", "stepfilled"]):
# Set log scale, then call hist().
axs_test[0, i].set_yscale("log")
... | @check_figures_equal(extensions=["png"])
def test_hist_log_2(fig_test, fig_ref):
| axs_test = fig_test.subplots(2, 3)
axs_ref = fig_ref.subplots(2, 3)
for i, histtype in enumerate(["bar", "step", "stepfilled"]):
# Set log scale, then call hist().
axs_test[0, i].set_yscale("log")
axs_test[0, i].hist(1, 1, histtype=histtype)
# Call hist(), then set log ... | 200)**3
data = np.concatenate([1 - data0, 1 + data0])
fig, ax = plt.subplots()
ax.hist(data, fill=False, log=True)
@check_figures_equal(extensions=["png"])
def test_hist_log_2(fig_test, fig_ref):
| 64 | 64 | 197 | 23 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_log_2 | test_hist_log_2 | 1,744 | 1,757 | 1,744 | 1,745 | 00f5617c67863ef0da70a0968193e2ed95aa1216 | bigcode/the-stack | train |
75a91ae159cbdf0f418dafe0 | train | function | def test_title_pad():
# check that title padding puts the title in the right
# place...
fig, ax = plt.subplots()
ax.set_title('aardvark', pad=30.)
m = ax.titleOffsetTrans.get_matrix()
assert m[1, -1] == (30. / 72. * fig.dpi)
ax.set_title('aardvark', pad=0.)
m = ax.titleOffsetTran... | def test_title_pad():
# check that title padding puts the title in the right
# place...
| fig, ax = plt.subplots()
ax.set_title('aardvark', pad=30.)
m = ax.titleOffsetTrans.get_matrix()
assert m[1, -1] == (30. / 72. * fig.dpi)
ax.set_title('aardvark', pad=0.)
m = ax.titleOffsetTrans.get_matrix()
assert m[1, -1] == 0.
# check that it is reverted...
ax.set_title('aa... | )
for j in range(0, 100, 2):
ax.plot(x, j*y, ls=(j, (10, 10)), lw=5, color='k')
def test_title_pad():
# check that title padding puts the title in the right
# place...
| 63 | 64 | 172 | 22 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_title_pad | test_title_pad | 5,583 | 5,596 | 5,583 | 5,585 | d907ebcdfdc38ec35e2b69888a034da6f49f5afc | bigcode/the-stack | train |
c61bce8205dedfaffe7f9114 | train | function | @image_comparison(['bxp_withmean_custompoint.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_showcustommean():
_bxp_test_helper(bxp_kwargs=dict(
showmeans=True,
meanprops=dict(linestyle='none', marker='d',... | @image_comparison(['bxp_withmean_custompoint.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_showcustommean():
| _bxp_test_helper(bxp_kwargs=dict(
showmeans=True,
meanprops=dict(linestyle='none', marker='d', mfc='green'),
))
| (
flierprops=dict(linestyle='none', marker='d', mfc='g')))
@image_comparison(['bxp_withmean_custompoint.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_showcustommean():
| 63 | 64 | 80 | 42 | 21 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_showcustommean | test_bxp_showcustommean | 2,694 | 2,702 | 2,694 | 2,698 | 159470db6aa0f5c4f1ef78a212c653a88fce89e2 | bigcode/the-stack | train |
ef11f5273abe6417d0535425 | train | class | class TestScatter:
@image_comparison(['scatter'], style='mpl20', remove_text=True)
def test_scatter_plot(self):
data = {"x": np.array([3, 4, 2, 6]), "y": np.array([2, 5, 2, 3]),
"c": ['r', 'y', 'b', 'lime'], "s": [24, 15, 19, 29],
"c2": ['0.5', '0.6', '0.7', '0.8']}
... | class TestScatter:
@image_comparison(['scatter'], style='mpl20', remove_text=True)
| def test_scatter_plot(self):
data = {"x": np.array([3, 4, 2, 6]), "y": np.array([2, 5, 2, 3]),
"c": ['r', 'y', 'b', 'lime'], "s": [24, 15, 19, 29],
"c2": ['0.5', '0.6', '0.7', '0.8']}
fig, ax = plt.subplots()
ax.scatter(data["x"] - 1., data["y"] - 1., c... | Reuse testcase from above for a labeled data test
data = {"x": x, "y": y}
fig, ax = plt.subplots()
ax.hist2d("x", "y", bins=10, data=data, rasterized=True)
@image_comparison(['hist2d_transpose'], remove_text=True, style='mpl20')
def test_hist2d_transpose():
# Remove this line when this test i... | 256 | 256 | 3,494 | 21 | 235 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | TestScatter | TestScatter | 2,125 | 2,381 | 2,125 | 2,126 | 812c3125192865fc01977be6c3353fd83148e5ec | bigcode/the-stack | train |
e9342205e7098eaf56d5a23d | train | function | @image_comparison(['symlog2.pdf'], remove_text=True)
def test_symlog2():
# Numbers from -50 to 50, with 0.1 as step
x = np.arange(-50, 50, 0.001)
fig, axs = plt.subplots(5, 1)
for ax, linthresh in zip(axs, [20., 2., 1., 0.1, 0.01]):
ax.plot(x, x)
ax.set_xscale('symlog', linthres... | @image_comparison(['symlog2.pdf'], remove_text=True)
def test_symlog2():
# Numbers from -50 to 50, with 0.1 as step
| x = np.arange(-50, 50, 0.001)
fig, axs = plt.subplots(5, 1)
for ax, linthresh in zip(axs, [20., 2., 1., 0.1, 0.01]):
ax.plot(x, x)
ax.set_xscale('symlog', linthresh=linthresh)
ax.grid(True)
axs[-1].set_ylim(-0.1, 0.1)
| symlog')
ax.set_xscale('linear')
ax.set_ylim(-1, 10000000)
@image_comparison(['symlog2.pdf'], remove_text=True)
def test_symlog2():
# Numbers from -50 to 50, with 0.1 as step
| 64 | 64 | 148 | 40 | 24 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_symlog2 | test_symlog2 | 1,036 | 1,046 | 1,036 | 1,038 | b02e41e8e96325be0f803b44df13b00125c91651 | bigcode/the-stack | train |
2ff4c234280932fb2c393160 | train | function | def test_pcolorargs_5205():
# Smoketest to catch issue found in gh:5205
x = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5]
y = [-1.5, -1.25, -1.0, -0.75, -0.5, -0.25, 0,
0.25, 0.5, 0.75, 1.0, 1.25, 1.5]
X, Y = np.meshgrid(x, y)
Z = np.hypot(X, Y)
plt.pcolor(Z)
plt.pcolor(list(Z))
... | def test_pcolorargs_5205():
# Smoketest to catch issue found in gh:5205
| x = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5]
y = [-1.5, -1.25, -1.0, -0.75, -0.5, -0.25, 0,
0.25, 0.5, 0.75, 1.0, 1.25, 1.5]
X, Y = np.meshgrid(x, y)
Z = np.hypot(X, Y)
plt.pcolor(Z)
plt.pcolor(list(Z))
plt.pcolor(x, y, Z[:-1, :-1])
plt.pcolor(X, Y, list(Z[:-1, :-1]))
| )
ax.set_xscale('symlog', linthresh=linthresh)
ax.grid(True)
axs[-1].set_ylim(-0.1, 0.1)
def test_pcolorargs_5205():
# Smoketest to catch issue found in gh:5205
| 64 | 64 | 195 | 23 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pcolorargs_5205 | test_pcolorargs_5205 | 1,049 | 1,060 | 1,049 | 1,050 | 584e4be08215a8a5bd005db69fd9c0b89e7338ef | bigcode/the-stack | train |
5a39f108e0aa7fb48d59d2fd | train | function | def test_tick_param_label_rotation():
fix, (ax, ax2) = plt.subplots(1, 2)
ax.plot([0, 1], [0, 1])
ax2.plot([0, 1], [0, 1])
ax.xaxis.set_tick_params(which='both', rotation=75)
ax.yaxis.set_tick_params(which='both', rotation=90)
for text in ax.get_xticklabels(which='both'):
assert t... | def test_tick_param_label_rotation():
| fix, (ax, ax2) = plt.subplots(1, 2)
ax.plot([0, 1], [0, 1])
ax2.plot([0, 1], [0, 1])
ax.xaxis.set_tick_params(which='both', rotation=75)
ax.yaxis.set_tick_params(which='both', rotation=90)
for text in ax.get_xticklabels(which='both'):
assert text.get_rotation() == 75
for text ... | for j in range(5):
ln, = ax.plot(range(3))
brs = ax.bar(range(3), range(3))
for br in brs:
assert to_rgb(ln.get_color()) == to_rgb(br.get_facecolor())
def test_tick_param_label_rotation():
| 63 | 64 | 205 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_tick_param_label_rotation | test_tick_param_label_rotation | 6,114 | 6,130 | 6,114 | 6,114 | a4fd1427f4114a1fb6e09a5ad00597866761b7a8 | bigcode/the-stack | train |
91159b459bfd57f55545a5ec | train | function | @pytest.mark.parametrize(
'params, expected_result',
[(_params(),
_result(c='b', colors=np.array([[0, 0, 1, 1]]))),
(_params(c='r'),
_result(c='r', colors=np.array([[1, 0, 0, 1]]))),
(_params(c='r', colors='b'),
_result(c='r', colors=np.array([[1, 0, 0, 1]]))),
# color
... | @pytest.mark.parametrize(
'params, expected_result',
[(_params(),
_result(c='b', colors=np.array([[0, 0, 1, 1]]))),
(_params(c='r'),
_result(c='r', colors=np.array([[1, 0, 0, 1]]))),
(_params(c='r', colors='b'),
_result(c='r', colors=np.array([[1, 0, 0, 1]]))),
# color
... | def get_next_color():
return 'blue' # currently unused
c, colors, _edgecolors = mpl.axes.Axes._parse_scatter_color_args(
*params, get_next_color_func=get_next_color)
assert c == expected_result.c
assert_allclose(colors, expected_result.colors)
| @pytest.mark.parametrize(
'params, expected_result',
[(_params(),
_result(c='b', colors=np.array([[0, 0, 1, 1]]))),
(_params(c='r'),
_result(c='r', colors=np.array([[1, 0, 0, 1]]))),
(_params(c='r', colors='b'),
_result(c='r', colors=np.array([[1, 0, 0, 1]]))),
# color
... | 206 | 81 | 272 | 206 | 0 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_parse_scatter_color_args | test_parse_scatter_color_args | 2,389 | 2,410 | 2,389 | 2,403 | 975ed6bf866c05d1f79692292241360a052d615e | bigcode/the-stack | train |
e070f256f38421d720ddc0dc | train | function | @pytest.mark.parametrize('x_inverted', [False, True])
@pytest.mark.parametrize('y_inverted', [False, True])
def test_indicate_inset_inverted(x_inverted, y_inverted):
"""
Test that the inset lines are correctly located with inverted data axes.
"""
fig, (ax1, ax2) = plt.subplots(1, 2)
x = np.... | @pytest.mark.parametrize('x_inverted', [False, True])
@pytest.mark.parametrize('y_inverted', [False, True])
def test_indicate_inset_inverted(x_inverted, y_inverted):
| """
Test that the inset lines are correctly located with inverted data axes.
"""
fig, (ax1, ax2) = plt.subplots(1, 2)
x = np.arange(10)
ax1.plot(x, x, 'o')
if x_inverted:
ax1.invert_xaxis()
if y_inverted:
ax1.invert_yaxis()
rect, bounds = ax1.indicate_in... | 0.692308],
[0.8425, 0.907692]])
np.testing.assert_allclose(
axin1.get_position().get_points(), xx, rtol=1e-4)
@pytest.mark.parametrize('x_inverted', [False, True])
@pytest.mark.parametrize('y_inverted', [False, True])
def test_indicate_inset_inverted(x_inverted, y_inverted):
| 88 | 88 | 295 | 42 | 46 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_indicate_inset_inverted | test_indicate_inset_inverted | 6,346 | 6,369 | 6,346 | 6,348 | d799ebcf92d0ccc17908d6f96671283aff06435f | bigcode/the-stack | train |
7427e4de4a2c8836244b95ad | train | function | def test_hist_stacked_step_bottom_geometry():
bins = [0, 1, 2, 3]
data_1 = [0, 0, 1, 1, 1, 2]
data_2 = [0, 1, 2]
_, _, patches = plt.hist([data_1, data_2],
bins=bins,
stacked=True,
bottom=[1, 2, 1.5],
... | def test_hist_stacked_step_bottom_geometry():
| bins = [0, 1, 2, 3]
data_1 = [0, 0, 1, 1, 1, 2]
data_2 = [0, 1, 2]
_, _, patches = plt.hist([data_1, data_2],
bins=bins,
stacked=True,
bottom=[1, 2, 1.5],
histtype='step')
as... | 6], [2, 3.5], [3, 3.5],
[3, 2.5], [2, 2.5], [2, 5], [1, 5], [1, 3], [0, 3]]
assert_array_equal(polygon.get_xy(), xy)
def test_hist_stacked_step_bottom_geometry():
| 80 | 80 | 269 | 9 | 71 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stacked_step_bottom_geometry | test_hist_stacked_step_bottom_geometry | 3,814 | 3,832 | 3,814 | 3,814 | 06f56fc8cf000e7146c1d68b1302d1b7d9a62bc8 | bigcode/the-stack | train |
5cca744875c8f1c4bb8ac6e5 | train | function | def test_normal_axes():
with rc_context({'_internal.classic_mode': False}):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
fig.canvas.draw()
plt.close(fig)
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
# test the axis bboxes
target = [
[123.375, 75.88... | def test_normal_axes():
| with rc_context({'_internal.classic_mode': False}):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
fig.canvas.draw()
plt.close(fig)
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
# test the axis bboxes
target = [
[123.375, 75.88888888888886, 983.25, 33.... | =bb.height,
linewidth=1.5, edgecolor="magenta", facecolor="none", transform=None,
zorder=2)
fig.add_artist(rect2)
bbax = bb
bb2 = ax.get_tightbbox(renderer)
rect2 = plt.Rectangle(
(bb2.x0, bb2.y0), width=bb2.width, height=bb2.height,
linewidth=3, edgecolor="red"... | 146 | 146 | 488 | 5 | 140 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_normal_axes | test_normal_axes | 6,561 | 6,597 | 6,561 | 6,561 | 1ef927baa0459918c9a4a2a1b8de96ecd6b5c1b7 | bigcode/the-stack | train |
0aef479705c5f788afe4d64b | train | function | def test_broken_barh_empty():
fig, ax = plt.subplots()
ax.broken_barh([], (.1, .5))
| def test_broken_barh_empty():
| fig, ax = plt.subplots()
ax.broken_barh([], (.1, .5))
| ticks with a large log range.
fig, ax = plt.subplots()
matplotlib.rcParams['axes.autolimit_mode'] = 'round_numbers'
ax.loglog([1e-20, 1e5], [1e-16, 10])
def test_broken_barh_empty():
| 63 | 64 | 29 | 8 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_broken_barh_empty | test_broken_barh_empty | 5,776 | 5,778 | 5,776 | 5,776 | 731f470d6c2a0ef041560fae37965118fd5d2fb3 | bigcode/the-stack | train |
075e5e1d56c81bb8dabbcfd9 | train | function | @image_comparison(['boxplot_no_inverted_whisker.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_no_weird_whisker():
x = np.array([3, 9000, 150, 88, 350, 200000, 1400, 960],
dtype=np.float64)
ax1 = plt.axes()
ax1.boxplot(x)
a... | @image_comparison(['boxplot_no_inverted_whisker.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_no_weird_whisker():
| x = np.array([3, 9000, 150, 88, 350, 200000, 1400, 960],
dtype=np.float64)
ax1 = plt.axes()
ax1.boxplot(x)
ax1.set_yscale('log')
ax1.yaxis.grid(False, which='minor')
ax1.xaxis.grid(False)
| vals=CIs, notch=1)
ax.set_ylim((-30, 30))
@image_comparison(['boxplot_no_inverted_whisker.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_no_weird_whisker():
| 63 | 64 | 127 | 45 | 18 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_no_weird_whisker | test_boxplot_no_weird_whisker | 2,987 | 2,996 | 2,987 | 2,989 | bf3b4acdc46a1decab18bdfb873953ae3e500be0 | bigcode/the-stack | train |
b11c75ecd6107c528e43c6e1 | train | function | @image_comparison(['hist_stacked_bar'])
def test_hist_stacked_bar():
# make some data
d = [[100, 100, 100, 100, 200, 320, 450, 80, 20, 600, 310, 800],
[20, 23, 50, 11, 100, 420], [120, 120, 120, 140, 140, 150, 180],
[60, 60, 60, 60, 300, 300, 5, 5, 5, 5, 10, 300],
[555, 555, 555... | @image_comparison(['hist_stacked_bar'])
def test_hist_stacked_bar():
# make some data
| d = [[100, 100, 100, 100, 200, 320, 450, 80, 20, 600, 310, 800],
[20, 23, 50, 11, 100, 420], [120, 120, 120, 140, 140, 150, 180],
[60, 60, 60, 60, 300, 300, 5, 5, 5, 5, 10, 300],
[555, 555, 555, 30, 30, 30, 30, 30, 100, 100, 100, 100, 30, 30],
[30, 30, 30, 30, 400, 400, 400, ... | [3, 2.5], [3, 1.5]]
assert_array_equal(polygon.get_xy(), xy)
polygon, = patches[1]
xy = [[0, 3], [0, 4], [1, 4], [1, 6], [2, 6], [2, 3.5], [3, 3.5], [3, 2.5]]
assert_array_equal(polygon.get_xy(), xy)
@image_comparison(['hist_stacked_bar'])
def test_hist_stacked_bar():
# make some data
| 127 | 127 | 425 | 23 | 104 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stacked_bar | test_hist_stacked_bar | 3,835 | 3,850 | 3,835 | 3,837 | 603f72f135f3f8575b749930bc01540d067e3297 | bigcode/the-stack | train |
2df51762b83e50f149936c81 | train | function | def test_zoom_inset():
dx, dy = 0.05, 0.05
# generate 2 2d grids for the x & y bounds
y, x = np.mgrid[slice(1, 5 + dy, dy),
slice(1, 5 + dx, dx)]
z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x)
fig, ax = plt.subplots()
ax.pcolormesh(x, y, z[:-1, :-1])
ax.set_as... | def test_zoom_inset():
| dx, dy = 0.05, 0.05
# generate 2 2d grids for the x & y bounds
y, x = np.mgrid[slice(1, 5 + dy, dy),
slice(1, 5 + dx, dx)]
z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x)
fig, ax = plt.subplots()
ax.pcolormesh(x, y, z[:-1, :-1])
ax.set_aspect(1.)
ax.apply_a... | ylim = [2, 2.5]
rect = [xlim[0], ylim[0], xlim[1] - xlim[0], ylim[1] - ylim[0]]
rec, connectors = ax.indicate_inset(bounds=rect)
assert connectors is None
fig.canvas.draw()
xx = np.array([[1.5, 2.],
[2.15, 2.5]])
assert np.all(rec.get_bbox().get_points() == xx)
... | 116 | 116 | 388 | 6 | 110 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_zoom_inset | test_zoom_inset | 6,313 | 6,343 | 6,313 | 6,313 | 01a51ee410a12ecfd22eaffbb2041fcd8cc265a2 | bigcode/the-stack | train |
5d36f4a4d4b7cd86e1c59c95 | train | function | def test_quiver_units():
fig, ax = plt.subplots()
dates = [datetime.datetime(2017, 7, 15, 18, i) for i in range(0, 60, 10)]
y = np.linspace(0, 5, len(dates))
u = v = np.linspace(0, 50, len(dates))
ax.quiver(dates, y, u, v)
| def test_quiver_units():
| fig, ax = plt.subplots()
dates = [datetime.datetime(2017, 7, 15, 18, i) for i in range(0, 60, 10)]
y = np.linspace(0, 5, len(dates))
u = v = np.linspace(0, 50, len(dates))
ax.quiver(dates, y, u, v)
| for i in range(0, 60, 10)]
y = np.linspace(0, 5, len(dates))
u = v = np.linspace(0, 50, len(dates))
ax.barbs(dates, y, u, v)
def test_quiver_units():
| 64 | 64 | 93 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_quiver_units | test_quiver_units | 6,096 | 6,101 | 6,096 | 6,096 | d52e55d2055df5e1d5f776d4a3a5ac39774514cf | bigcode/the-stack | train |
db3526fa9f9a1ac5ba40b505 | train | function | def test_errorbar_every_invalid():
x = np.linspace(0, 1, 15)
y = x * (1-x)
yerr = y/6
ax = plt.figure().subplots()
with pytest.raises(ValueError, match='not a tuple of two integers'):
ax.errorbar(x, y, yerr, errorevery=(1, 2, 3))
with pytest.raises(ValueError, match='not a tup... | def test_errorbar_every_invalid():
| x = np.linspace(0, 1, 15)
y = x * (1-x)
yerr = y/6
ax = plt.figure().subplots()
with pytest.raises(ValueError, match='not a tuple of two integers'):
ax.errorbar(x, y, yerr, errorevery=(1, 2, 3))
with pytest.raises(ValueError, match='not a tuple of two integers'):
ax.er... | 0.5, color='tab:green')
ax.errorbar(x=[2, 4, 10], y=[4, 5, 6], yerr=0.5, fmt='tab:blue')
ax.set_xlim(1, 11)
def test_errorbar_every_invalid():
| 64 | 64 | 191 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_errorbar_every_invalid | test_errorbar_every_invalid | 3,500 | 3,514 | 3,500 | 3,500 | 21ae4dba1869cd9d44aebba8194292347e9d57fa | bigcode/the-stack | train |
6ae17c7161c39104185fefdc | train | function | @image_comparison(['bxp_percentilewhis.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_percentilewhis():
_bxp_test_helper(stats_kwargs=dict(whis=[5, 95]))
| @image_comparison(['bxp_percentilewhis.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_percentilewhis():
| _bxp_test_helper(stats_kwargs=dict(whis=[5, 95]))
| _bxp_rangewhis():
_bxp_test_helper(stats_kwargs=dict(whis=[0, 100]))
@image_comparison(['bxp_percentilewhis.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_percentilewhis():
| 63 | 64 | 56 | 38 | 25 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_percentilewhis | test_bxp_percentilewhis | 2,626 | 2,630 | 2,626 | 2,629 | c7b80612db9a98f15f76c90f9ba618478dfd62c5 | bigcode/the-stack | train |
43fc5913192ee05c97f4366e | train | function | @image_comparison(['hist_density.png'])
def test_hist_density():
np.random.seed(19680801)
data = np.random.standard_normal(2000)
fig, ax = plt.subplots()
ax.hist(data, density=True)
| @image_comparison(['hist_density.png'])
def test_hist_density():
| np.random.seed(19680801)
data = np.random.standard_normal(2000)
fig, ax = plt.subplots()
ax.hist(data, density=True)
| /%s' % (kg, _type))
ax.set_ylim(bottom=-50)
patches = axs[0, 0].patches
assert all(p.get_facecolor() == p.get_edgecolor() for p in patches)
@image_comparison(['hist_density.png'])
def test_hist_density():
| 64 | 64 | 50 | 14 | 50 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_density | test_hist_density | 1,803 | 1,808 | 1,803 | 1,804 | 8ebb213df5a968a9c429e8891b0ac2eb7353522e | bigcode/the-stack | train |
ff4fc46b3bf64be950812fa1 | train | function | @pytest.mark.parametrize(('colors'), [
('0.5',), # string color with multiple characters: not OK before #8193 fix
('tab:orange', 'tab:pink', 'tab:cyan', 'bLacK'), # case-insensitive
('red', (0, 1, 0), None, (1, 0, 1, 0.5)), # a tricky case mixing types
])
def test_eventplot_colors(colors):
"""T... | @pytest.mark.parametrize(('colors'), [
('0.5',), # string color with multiple characters: not OK before #8193 fix
('tab:orange', 'tab:pink', 'tab:cyan', 'bLacK'), # case-insensitive
('red', (0, 1, 0), None, (1, 0, 1, 0.5)), # a tricky case mixing types
])
def test_eventplot_colors(colors):
| """Test the *colors* parameter of eventplot. Inspired by issue #8193."""
data = [[0], [1], [2], [3]] # 4 successive events of different nature
# Build the list of the expected colors
expected = [c if c is not None else 'C0' for c in colors]
# Convert the list into an array of RGBA values
... | @pytest.mark.parametrize(('colors'), [
('0.5',), # string color with multiple characters: not OK before #8193 fix
('tab:orange', 'tab:pink', 'tab:cyan', 'bLacK'), # case-insensitive
('red', (0, 1, 0), None, (1, 0, 1, 0.5)), # a tricky case mixing types
])
def test_eventplot_colors(colors):
| 103 | 99 | 331 | 103 | 0 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_eventplot_colors | test_eventplot_colors | 4,048 | 4,071 | 4,048 | 4,053 | e1c12059b6b0e91c3bfc9be316627c619785529a | bigcode/the-stack | train |
500beb99ff108fd2da1e36f0 | train | function | def test_rc_major_minor_tick():
d = {'xtick.top': True, 'ytick.right': True, # Enable all ticks
'xtick.bottom': True, 'ytick.left': True,
# Selectively disable
'xtick.minor.bottom': False, 'xtick.major.bottom': False,
'ytick.major.left': False, 'ytick.minor.left': False}
... | def test_rc_major_minor_tick():
| d = {'xtick.top': True, 'ytick.right': True, # Enable all ticks
'xtick.bottom': True, 'ytick.left': True,
# Selectively disable
'xtick.minor.bottom': False, 'xtick.major.bottom': False,
'ytick.major.left': False, 'ytick.minor.left': False}
with plt.rc_context(rc=d):
... | On']
assert xax._minor_tick_kw['tick2On']
assert yax._major_tick_kw['tick1On']
assert not yax._major_tick_kw['tick2On']
assert yax._minor_tick_kw['tick1On']
assert not yax._minor_tick_kw['tick2On']
def test_rc_major_minor_tick():
| 73 | 74 | 248 | 7 | 66 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_rc_major_minor_tick | test_rc_major_minor_tick | 5,447 | 5,467 | 5,447 | 5,447 | 52f23f888564591841b3f78ac189ebc792bcf7fd | bigcode/the-stack | train |
c4bff8db7f2935706551c501 | train | function | @pytest.fixture(params=['gca', 'subplots', 'subplots_shared', 'add_axes'])
def shared_axes_generator(request):
# test all of the ways to get fig/ax sets
if request.param == 'gca':
fig = plt.figure()
ax = fig.gca()
elif request.param == 'subplots':
fig, ax = plt.subplots()
... | @pytest.fixture(params=['gca', 'subplots', 'subplots_shared', 'add_axes'])
def shared_axes_generator(request):
# test all of the ways to get fig/ax sets
| if request.param == 'gca':
fig = plt.figure()
ax = fig.gca()
elif request.param == 'subplots':
fig, ax = plt.subplots()
elif request.param == 'subplots_shared':
fig, ax_lst = plt.subplots(2, 2, sharex='all', sharey='all')
ax = ax_lst[0][0]
elif request.par... | > 14
return {"x": _helper_x, "y": _helper_y}[request.param]
@pytest.fixture(params=['gca', 'subplots', 'subplots_shared', 'add_axes'])
def shared_axes_generator(request):
# test all of the ways to get fig/ax sets
| 63 | 64 | 163 | 40 | 23 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | shared_axes_generator | shared_axes_generator | 5,701 | 5,715 | 5,701 | 5,703 | a7f0b3800639bea3a9c22a7f43ed0c4b4259a942 | bigcode/the-stack | train |
e16b08cfb96a1b368eaa4896 | train | function | @check_figures_equal(extensions=['png'])
def test_stairs_baseline_0(fig_test, fig_ref):
# Test
test_ax = fig_test.add_subplot()
test_ax.stairs([5, 6, 7], baseline=None)
# Ref
ref_ax = fig_ref.add_subplot()
style = {'solid_joinstyle': 'miter', 'solid_capstyle': 'butt'}
ref_ax.plot(r... | @check_figures_equal(extensions=['png'])
def test_stairs_baseline_0(fig_test, fig_ref):
# Test
| test_ax = fig_test.add_subplot()
test_ax.stairs([5, 6, 7], baseline=None)
# Ref
ref_ax = fig_ref.add_subplot()
style = {'solid_joinstyle': 'miter', 'solid_capstyle': 'butt'}
ref_ax.plot(range(4), [5, 6, 7, 7], drawstyle='steps-post', **style)
ref_ax.set_ylim(0, None)
| ref_ax = fig_ref.add_subplot()
h = ref_ax.stairs([1, 2, 3], baseline=-2)
ref_ax.set_ylim(ylim)
@check_figures_equal(extensions=['png'])
def test_stairs_baseline_0(fig_test, fig_ref):
# Test
| 64 | 64 | 128 | 28 | 36 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stairs_baseline_0 | test_stairs_baseline_0 | 1,973 | 1,983 | 1,973 | 1,975 | 848ff8a1ab83ce530a07d7cb9bcb9f8ee3df6f41 | bigcode/the-stack | train |
5066b798f51f2aaaebc1dc5a | train | function | def test_empty_line_plots():
# Incompatible nr columns, plot "nothing"
x = np.ones(10)
y = np.ones((10, 0))
_, ax = plt.subplots()
line = ax.plot(x, y)
assert len(line) == 0
# Ensure plot([],[]) creates line
_, ax = plt.subplots()
line = ax.plot([], [])
assert len(lin... | def test_empty_line_plots():
# Incompatible nr columns, plot "nothing"
| x = np.ones(10)
y = np.ones((10, 0))
_, ax = plt.subplots()
line = ax.plot(x, y)
assert len(line) == 0
# Ensure plot([],[]) creates line
_, ax = plt.subplots()
line = ax.plot([], [])
assert len(line) == 1
| , 3] == [*lines, 1, 2, 3]
assert [1, 2, 3] + ax.lines == [1, 2, 3, *lines]
def test_empty_line_plots():
# Incompatible nr columns, plot "nothing"
| 63 | 64 | 95 | 18 | 45 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_empty_line_plots | test_empty_line_plots | 7,243 | 7,254 | 7,243 | 7,244 | 60b0f447a86465f24fd7c564f3182eb2678cdc0f | bigcode/the-stack | train |
4091bad2028031fc35ea54fd | train | function | @mpl.style.context('default')
def test_fillbetween_cycle():
fig, ax = plt.subplots()
for j in range(3):
cc = ax.fill_between(range(3), range(3))
target = mcolors.to_rgba('C{}'.format(j))
assert tuple(cc.get_facecolors().squeeze()) == tuple(target)
for j in range(3, 6):
... | @mpl.style.context('default')
def test_fillbetween_cycle():
| fig, ax = plt.subplots()
for j in range(3):
cc = ax.fill_between(range(3), range(3))
target = mcolors.to_rgba('C{}'.format(j))
assert tuple(cc.get_facecolors().squeeze()) == tuple(target)
for j in range(3, 6):
cc = ax.fill_betweenx(range(3), range(3))
targe... | ax2.tick_params(axis='x', labelrotation=53)
ax2.tick_params(axis='y', rotation=35)
for text in ax2.get_xticklabels(which='major'):
assert text.get_rotation() == 53
for text in ax2.get_yticklabels(which='major'):
assert text.get_rotation() == 35
@mpl.style.context('default')
def tes... | 87 | 87 | 291 | 13 | 73 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_fillbetween_cycle | test_fillbetween_cycle | 6,133 | 6,158 | 6,133 | 6,134 | 18d9b2246324980d615c1f3d012bc215034464f5 | bigcode/the-stack | train |
57401b8f7a490216af6ed3cb | train | function | def test_arrow_in_view():
_, ax = plt.subplots()
ax.arrow(1, 1, 1, 1)
assert ax.get_xlim() == (0.8, 2.2)
assert ax.get_ylim() == (0.8, 2.2)
| def test_arrow_in_view():
| _, ax = plt.subplots()
ax.arrow(1, 1, 1, 1)
assert ax.get_xlim() == (0.8, 2.2)
assert ax.get_ylim() == (0.8, 2.2)
| head_width=theta / 10,
head_length=theta / 10)
def test_arrow_empty():
_, ax = plt.subplots()
# Create an empty FancyArrow
ax.arrow(0, 0, 0, 0, head_length=0)
def test_arrow_in_view():
| 64 | 64 | 62 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_arrow_in_view | test_arrow_in_view | 571 | 575 | 571 | 571 | 36f208703ac2817226f56ef5c24107bfcb76aee1 | bigcode/the-stack | train |
f8755fb82ba0d6da4767d791 | train | function | @image_comparison(['vlines_basic', 'vlines_with_nan', 'vlines_masked'],
extensions=['png'])
def test_vlines():
# normal
x1 = [2, 3, 4, 5, 7]
y1 = [2, -6, 3, 8, 2]
fig1, ax1 = plt.subplots()
ax1.vlines(x1, 0, y1, colors='g', linewidth=5)
# GH #7406
x2 = [2, 3, 4, ... | @image_comparison(['vlines_basic', 'vlines_with_nan', 'vlines_masked'],
extensions=['png'])
def test_vlines():
# normal
| x1 = [2, 3, 4, 5, 7]
y1 = [2, -6, 3, 8, 2]
fig1, ax1 = plt.subplots()
ax1.vlines(x1, 0, y1, colors='g', linewidth=5)
# GH #7406
x2 = [2, 3, 4, 5, 6, 7]
y2 = [2, -6, 3, 8, np.nan, 2]
fig2, (ax2, ax3, ax4) = plt.subplots(nrows=3, figsize=(4, 8))
ax2.vlines(x2, 0, y2, colors='... | ax.axline((0, 0), (1, 1), slope=1) # redundant parameters
ax.set_xscale('log')
with pytest.raises(TypeError):
ax.axline((0, 0), slope=1)
ax.set_xscale('linear')
ax.set_yscale('log')
with pytest.raises(TypeError):
ax.axline((0, 0), slope=1)
ax.set_yscale('linear')
w... | 171 | 171 | 572 | 35 | 136 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_vlines | test_vlines | 4,288 | 4,325 | 4,288 | 4,291 | 3c175c62376532ab785d977f46d93f0eba465545 | bigcode/the-stack | train |
b66a9f7e9ad1b141e7e3a43a | train | function | @check_figures_equal()
def test_axline_loglog(fig_test, fig_ref):
ax = fig_test.subplots()
ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
ax.loglog([.3, .6], [.3, .6], ".-")
ax.axline((1, 1e-3), (10, 1e-2), c="k")
ax = fig_ref.subplots()
ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
ax.loglog([.3... | @check_figures_equal()
def test_axline_loglog(fig_test, fig_ref):
| ax = fig_test.subplots()
ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
ax.loglog([.3, .6], [.3, .6], ".-")
ax.axline((1, 1e-3), (10, 1e-2), c="k")
ax = fig_ref.subplots()
ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
ax.loglog([.3, .6], [.3, .6], ".-")
ax.loglog([1, 10], [1e-3, 1e-2], c="k")
... | (j, lw=5, color='k', zorder=j)
ax.axhline(-j, lw=5, color='k', zorder=j)
ax.set_title("errorbar zorder test")
@check_figures_equal()
def test_axline_loglog(fig_test, fig_ref):
| 63 | 64 | 170 | 18 | 45 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axline_loglog | test_axline_loglog | 4,195 | 4,205 | 4,195 | 4,196 | 90fac8933f049468f4b3a7af4582417a2dad6b75 | bigcode/the-stack | train |
56354bacd656bf2ac5598895 | train | function | def test_twin_inherit_autoscale_setting():
fig, ax = plt.subplots()
ax_x_on = ax.twinx()
ax.set_autoscalex_on(False)
ax_x_off = ax.twinx()
assert ax_x_on.get_autoscalex_on()
assert not ax_x_off.get_autoscalex_on()
ax_y_on = ax.twiny()
ax.set_autoscaley_on(False)
ax_y_off... | def test_twin_inherit_autoscale_setting():
| fig, ax = plt.subplots()
ax_x_on = ax.twinx()
ax.set_autoscalex_on(False)
ax_x_off = ax.twinx()
assert ax_x_on.get_autoscalex_on()
assert not ax_x_off.get_autoscalex_on()
ax_y_on = ax.twiny()
ax.set_autoscaley_on(False)
ax_y_off = ax.twiny()
assert ax_y_on.get_auto... | 10)
ax2 = plt.twinx(ax)
ax2.plot(x2, y2, 'r--', lw=5)
ax.margins(0, 0)
ax2.margins(0, 0)
def test_twin_inherit_autoscale_setting():
| 64 | 64 | 127 | 11 | 53 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_twin_inherit_autoscale_setting | test_twin_inherit_autoscale_setting | 373 | 387 | 373 | 373 | 5ff440077a6f1bce92f2a002f7ef499fd88e31f2 | bigcode/the-stack | train |
54001f94c96246d5c7e09f98 | train | function | @check_figures_equal(extensions=['png'])
def test_reset_ticks(fig_test, fig_ref):
for fig in [fig_ref, fig_test]:
ax = fig.add_subplot()
ax.grid(True)
ax.tick_params(
direction='in', length=10, width=5, color='C0', pad=12,
labelsize=14, labelcolor='C1', labelro... | @check_figures_equal(extensions=['png'])
def test_reset_ticks(fig_test, fig_ref):
| for fig in [fig_ref, fig_test]:
ax = fig.add_subplot()
ax.grid(True)
ax.tick_params(
direction='in', length=10, width=5, color='C0', pad=12,
labelsize=14, labelcolor='C1', labelrotation=45,
grid_color='C2', grid_alpha=0.8, grid_linewidth=3,
... | .rc_context({'axes.grid': True}):
ax.clear()
ax.tick_params(reset=True, which='major', labelsize=10)
assert ax.xaxis.majorTicks[0].gridline.get_visible()
@check_figures_equal(extensions=['png'])
def test_reset_ticks(fig_test, fig_ref):
| 64 | 64 | 182 | 20 | 44 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_reset_ticks | test_reset_ticks | 4,828 | 4,845 | 4,828 | 4,829 | 89a40c198f878dfdd9663bc82cd44c8e3140fae1 | bigcode/the-stack | train |
bc06a8ecf556abec6aa0ad91 | train | function | def test_boxplot_dates_pandas(pd):
# smoke test for boxplot and dates in pandas
data = np.random.rand(5, 2)
years = pd.date_range('1/1/2000',
periods=2, freq=pd.DateOffset(years=1)).year
plt.figure()
plt.boxplot(data, positions=years)
| def test_boxplot_dates_pandas(pd):
# smoke test for boxplot and dates in pandas
| data = np.random.rand(5, 2)
years = pd.date_range('1/1/2000',
periods=2, freq=pd.DateOffset(years=1)).year
plt.figure()
plt.boxplot(data, positions=years)
| in [1, 2]])
ax.broken_barh([(datetime.datetime(2018, 1, 1),
datetime.timedelta(hours=1))],
(10, 20))
def test_boxplot_dates_pandas(pd):
# smoke test for boxplot and dates in pandas
| 63 | 64 | 77 | 21 | 42 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_dates_pandas | test_boxplot_dates_pandas | 1,646 | 1,652 | 1,646 | 1,647 | db739a8e699056005b4e3ee8e60f6488e7f1adb1 | bigcode/the-stack | train |
3a407f3f9e30244706a7421b | train | function | @image_comparison(['twin_spines.png'], remove_text=True)
def test_twin_spines():
def make_patch_spines_invisible(ax):
ax.set_frame_on(True)
ax.patch.set_visible(False)
ax.spines[:].set_visible(False)
fig = plt.figure(figsize=(4, 3))
fig.subplots_adjust(right=0.75)
h... | @image_comparison(['twin_spines.png'], remove_text=True)
def test_twin_spines():
| def make_patch_spines_invisible(ax):
ax.set_frame_on(True)
ax.patch.set_visible(False)
ax.spines[:].set_visible(False)
fig = plt.figure(figsize=(4, 3))
fig.subplots_adjust(right=0.75)
host = fig.add_subplot()
par1 = host.twinx()
par2 = host.twinx()
# Of... | _equal(extensions=['png'])
def test_twin_remove(fig_test, fig_ref):
ax_test = fig_test.add_subplot()
ax_twinx = ax_test.twinx()
ax_twiny = ax_test.twiny()
ax_twinx.remove()
ax_twiny.remove()
ax_ref = fig_ref.add_subplot()
# Ideally we also undo tick changes when calling ``remove()`... | 143 | 143 | 479 | 23 | 120 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_twin_spines | test_twin_spines | 4,708 | 4,750 | 4,708 | 4,710 | f30aca64fd311c55b1280bfc2c1d35ff74ff2798 | bigcode/the-stack | train |
b7600d578ff948ee9592a69e | train | function | def test_ytickcolor_is_not_markercolor():
plt.rcParams['lines.markeredgecolor'] = 'white'
ax = plt.axes()
ticks = ax.yaxis.get_major_ticks()
for tick in ticks:
assert tick.tick1line.get_markeredgecolor() != 'white'
| def test_ytickcolor_is_not_markercolor():
| plt.rcParams['lines.markeredgecolor'] = 'white'
ax = plt.axes()
ticks = ax.yaxis.get_major_ticks()
for tick in ticks:
assert tick.tick1line.get_markeredgecolor() != 'white'
| ():
plt.rcParams['lines.markeredgecolor'] = 'white'
ax = plt.axes()
ticks = ax.xaxis.get_major_ticks()
for tick in ticks:
assert tick.tick1line.get_markeredgecolor() != 'white'
def test_ytickcolor_is_not_markercolor():
| 63 | 64 | 62 | 11 | 52 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_ytickcolor_is_not_markercolor | test_ytickcolor_is_not_markercolor | 6,915 | 6,920 | 6,915 | 6,915 | b517d0cadceb472161a3e33798f5de76596bad7a | bigcode/the-stack | train |
8de43ccf93d4adea00c1f9da | train | function | def test_displaced_spine():
with rc_context({'_internal.classic_mode': False}):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
ax.set(xticklabels=[], yticklabels=[])
ax.spines.bottom.set_position(('axes', -0.1))
fig.canvas.draw()
bbaxis, bbspines, bbax, bbtb = color_bo... | def test_displaced_spine():
| with rc_context({'_internal.classic_mode': False}):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
ax.set(xticklabels=[], yticklabels=[])
ax.spines.bottom.set_position(('axes', -0.1))
fig.canvas.draw()
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
targets =... | 99997, 930.0, 960.0]
targetbb = mtransforms.Bbox.from_bounds(*target)
assert_allclose(bbax.bounds, targetbb.bounds, atol=1e-2)
target = [150., 120., 930., 960.]
targetbb = mtransforms.Bbox.from_bounds(*target)
assert_allclose(bbtb.bounds, targetbb.bounds, atol=1e-2)
def test_displaced_spine()... | 103 | 103 | 344 | 7 | 96 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_displaced_spine | test_displaced_spine | 6,630 | 6,654 | 6,630 | 6,630 | c672f41fbdd314b2fc24465b0b7d42423035c7c4 | bigcode/the-stack | train |
98806c619ac4f844442656e0 | train | function | def test_axes_tick_params_gridlines():
# Now treating grid params like other Tick params
ax = plt.subplot()
ax.tick_params(grid_color='b', grid_linewidth=5, grid_alpha=0.5,
grid_linestyle='dashdot')
for axis in ax.xaxis, ax.yaxis:
assert axis.majorTicks[0].gridline.get_c... | def test_axes_tick_params_gridlines():
# Now treating grid params like other Tick params
| ax = plt.subplot()
ax.tick_params(grid_color='b', grid_linewidth=5, grid_alpha=0.5,
grid_linestyle='dashdot')
for axis in ax.xaxis, ax.yaxis:
assert axis.majorTicks[0].gridline.get_color() == 'b'
assert axis.majorTicks[0].gridline.get_linewidth() == 5
assert ... | assert axis_1.yaxis.majorTicks[0].label1.get_size() == 30.0
assert axis_1.yaxis.majorTicks[0].label1.get_color() == 'red'
def test_axes_tick_params_gridlines():
# Now treating grid params like other Tick params
| 63 | 64 | 139 | 19 | 44 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axes_tick_params_gridlines | test_axes_tick_params_gridlines | 5,875 | 5,884 | 5,875 | 5,876 | 424df34543c98282ab7e4de7758aebcf523cfb44 | bigcode/the-stack | train |
30ddf23a6b98ab56b4703c55 | train | function | def test_pandas_errorbar_indexing(pd):
df = pd.DataFrame(np.random.uniform(size=(5, 4)),
columns=['x', 'y', 'xe', 'ye'],
index=[1, 2, 3, 4, 5])
fig, ax = plt.subplots()
ax.errorbar('x', 'y', xerr='xe', yerr='ye', data=df)
| def test_pandas_errorbar_indexing(pd):
| df = pd.DataFrame(np.random.uniform(size=(5, 4)),
columns=['x', 'y', 'xe', 'ye'],
index=[1, 2, 3, 4, 5])
fig, ax = plt.subplots()
ax.errorbar('x', 'y', xerr='xe', yerr='ye', data=df)
| .DataFrame({'dates': dates, 'values': values})
ax = plt.gca()
without_zero_index = df[np.array(df.index) % 2 == 1].copy()
ax.plot('dates', 'values', data=without_zero_index)
def test_pandas_errorbar_indexing(pd):
| 64 | 64 | 88 | 10 | 54 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pandas_errorbar_indexing | test_pandas_errorbar_indexing | 5,810 | 5,815 | 5,810 | 5,810 | 6e82cd3772e1547243b26aac790890aa5ba56028 | bigcode/the-stack | train |
8521524b1944958f8c0f009c | train | function | @check_figures_equal()
def test_label_loc_vertical(fig_test, fig_ref):
ax = fig_test.subplots()
sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
ax.legend()
ax.set_ylabel('Y Label', loc='top')
ax.set_xlabel('X Label', loc='right')
cbar = fig_test.colorbar(sc)
cbar.set_label... | @check_figures_equal()
def test_label_loc_vertical(fig_test, fig_ref):
| ax = fig_test.subplots()
sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
ax.legend()
ax.set_ylabel('Y Label', loc='top')
ax.set_xlabel('X Label', loc='right')
cbar = fig_test.colorbar(sc)
cbar.set_label("Z Label", loc='top')
ax = fig_ref.subplots()
sc = ax.scatte... | fig, ax = plt.subplots()
ax.set_xlabel('x label')
ax.set_ylabel('y label')
assert ax.get_xlabel() == 'x label'
assert ax.get_ylabel() == 'y label'
@check_figures_equal()
def test_label_loc_vertical(fig_test, fig_ref):
| 63 | 64 | 201 | 17 | 46 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_label_loc_vertical | test_label_loc_vertical | 48 | 64 | 48 | 49 | 265db1a070838d505622e243e0f48d585505c5bf | bigcode/the-stack | train |
a112bf8ec2c676228ff30300 | train | function | def test_secondary_fail():
fig, ax = plt.subplots()
ax.plot(np.arange(2, 11), np.arange(2, 11))
with pytest.raises(ValueError):
ax.secondary_xaxis(0.2, functions=(lambda x: 1 / x))
with pytest.raises(ValueError):
ax.secondary_xaxis('right')
with pytest.raises(ValueError):
... | def test_secondary_fail():
| fig, ax = plt.subplots()
ax.plot(np.arange(2, 11), np.arange(2, 11))
with pytest.raises(ValueError):
ax.secondary_xaxis(0.2, functions=(lambda x: 1 / x))
with pytest.raises(ValueError):
ax.secondary_xaxis('right')
with pytest.raises(ValueError):
ax.secondary_yaxis('bot... | ax(0.4, functions=(lambda x: 2 * x, lambda x: x / 2))
secax(0.6, functions=(lambda x: x**2, lambda x: x**(1/2)))
secax(0.8)
def test_secondary_fail():
| 64 | 64 | 89 | 5 | 59 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_secondary_fail | test_secondary_fail | 6,456 | 6,464 | 6,456 | 6,456 | 24f4300a05e2a7e5fe2d96f3037802576482335a | bigcode/the-stack | train |
af448d424bd389a16e3be10b | train | function | @image_comparison(
["specgram_magnitude_freqs.png", "specgram_magnitude_freqs_linear.png",
"specgram_magnitude_noise.png", "specgram_magnitude_noise_linear.png"],
remove_text=True, tol=0.07, style="default")
def test_specgram_magnitude():
"""Test axes.specgram in magnitude mode."""
# use fo... | @image_comparison(
["specgram_magnitude_freqs.png", "specgram_magnitude_freqs_linear.png",
"specgram_magnitude_noise.png", "specgram_magnitude_noise_linear.png"],
remove_text=True, tol=0.07, style="default")
def test_specgram_magnitude():
| """Test axes.specgram in magnitude mode."""
# use former defaults to match existing baseline image
matplotlib.rcParams['image.interpolation'] = 'nearest'
n = 1000
Fs = 10.
fstims = [[Fs/4, Fs/5, Fs/11], [Fs/4.7, Fs/5.6, Fs/11.9]]
NFFT_freqs = int(100 * Fs / np.min(fstims))
x... | pad_to, sides=sides)
for ax, sides in zip(plt.figure().subplots(3), all_sides):
ax.specgram(y, NFFT=NFFT, Fs=Fs, noverlap=noverlap,
pad_to=pad_to, sides=sides,
scale="linear", norm=matplotlib.colors.LogNorm())
@image_comparison(
["specgram_mag... | 138 | 139 | 466 | 65 | 73 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_specgram_magnitude | test_specgram_magnitude | 4,498 | 4,532 | 4,498 | 4,502 | aea179f93a03d81b437ebda418a2bf898cf75eb1 | bigcode/the-stack | train |
95a4b668e26f6893778b0820 | train | function | def test_boxplot_bad_ci():
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig, ax = plt.subplots()
with pytest.raises(ValueError):
ax.boxplot([x, x], conf_intervals=[[1, 2]])
with pytest.raises(ValueError):
ax.boxplot([x, x], conf_intervals=[[1, 2], [1]])
| def test_boxplot_bad_ci():
| x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig, ax = plt.subplots()
with pytest.raises(ValueError):
ax.boxplot([x, x], conf_intervals=[[1, 2]])
with pytest.raises(ValueError):
ax.boxplot([x, x], conf_intervals=[[1, 2], [1]])
| plt.subplots()
with pytest.raises(ValueError):
ax.boxplot(x, usermedians=[1, 2])
with pytest.raises(ValueError):
ax.boxplot([x, x], usermedians=[[1, 2], [1, 2]])
def test_boxplot_bad_ci():
| 63 | 64 | 98 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_bad_ci | test_boxplot_bad_ci | 3,009 | 3,016 | 3,009 | 3,009 | ff1ad1f91c97aefaf6931f0062e83445f995718e | bigcode/the-stack | train |
e9704d727fcc2ae9c052a261 | train | function | @image_comparison(['log_scales'])
def test_log_scales():
fig, ax = plt.subplots()
ax.plot(np.log(np.linspace(0.1, 100)))
ax.set_yscale('log', base=5.5)
ax.invert_yaxis()
ax.set_xscale('log', base=9.0)
| @image_comparison(['log_scales'])
def test_log_scales():
| fig, ax = plt.subplots()
ax.plot(np.log(np.linspace(0.1, 100)))
ax.set_yscale('log', base=5.5)
ax.invert_yaxis()
ax.set_xscale('log', base=9.0)
| .subplots()
fig2, ax2 = plt.subplots()
plt.sca(ax1)
assert ax1 is plt.gca()
assert fig1 is plt.gcf()
plt.close(fig1)
plt.close(fig2)
@image_comparison(['log_scales'])
def test_log_scales():
| 64 | 64 | 74 | 15 | 49 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_log_scales | test_log_scales | 2,523 | 2,529 | 2,523 | 2,524 | 3495e913e89caf90c81942bb978a18f8639453d9 | bigcode/the-stack | train |
f986f6a14805aa23212a3e5a | train | function | def test_hexbin_log_clim():
x, y = np.arange(200).reshape((2, 100))
fig, ax = plt.subplots()
h = ax.hexbin(x, y, bins='log', vmin=2, vmax=100)
assert h.get_clim() == (2, 100)
| def test_hexbin_log_clim():
| x, y = np.arange(200).reshape((2, 100))
fig, ax = plt.subplots()
h = ax.hexbin(x, y, bins='log', vmin=2, vmax=100)
assert h.get_clim() == (2, 100)
| np.power(2, y * 0.5)
fig, ax = plt.subplots()
h = ax.hexbin(x, y, yscale='log', bins='log',
marginals=True, reduce_C_function=np.sum)
plt.colorbar(h)
def test_hexbin_log_clim():
| 64 | 64 | 70 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hexbin_log_clim | test_hexbin_log_clim | 789 | 793 | 789 | 789 | 421efd38cc4bf8b9cc2ce2c29e20cba4b6914722 | bigcode/the-stack | train |
70c1ea50e703eed6679d48fb | train | function | @image_comparison(['bxp_custommedian.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_custommedian():
_bxp_test_helper(bxp_kwargs=dict(
medianprops=dict(linestyle='--', color='b', lw=3)))
| @image_comparison(['bxp_custommedian.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_custommedian():
| _bxp_test_helper(bxp_kwargs=dict(
medianprops=dict(linestyle='--', color='b', lw=3)))
| _helper(bxp_kwargs=dict(
boxprops=dict(linestyle='--', color='b', lw=3)))
@image_comparison(['bxp_custommedian.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_custommedian():
| 63 | 64 | 68 | 39 | 24 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_custommedian | test_bxp_custommedian | 2,714 | 2,720 | 2,714 | 2,718 | 2e2dc9e5fa77695414465700b08fc3a910dd4c0a | bigcode/the-stack | train |
a21131f2447d427c27b9259f | train | function | def test_hist_auto_bins():
_, bins, _ = plt.hist([[1, 2, 3], [3, 4, 5, 6]], bins='auto')
assert bins[0] <= 1
assert bins[-1] >= 6
| def test_hist_auto_bins():
| _, bins, _ = plt.hist([[1, 2, 3], [3, 4, 5, 6]], bins='auto')
assert bins[0] <= 1
assert bins[-1] >= 6
| )
fig, ax = plt.subplots()
ax.plot(x, m)
dt = mdates.date2num(np.datetime64('0000-12-31'))
assert ax.get_xlim() == (730120.0 + dt, 733773.0 + dt)
def test_hist_auto_bins():
| 64 | 64 | 59 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_auto_bins | test_hist_auto_bins | 6,751 | 6,754 | 6,751 | 6,751 | 05d1cd97f634cb8f6fb1a2bb471c617951ad4bc7 | bigcode/the-stack | train |
35735e21b8716308cec9ff91 | train | function | def test_inverted_limits():
# Test gh:1553
# Calling invert_xaxis prior to plotting should not disable autoscaling
# while still maintaining the inverted direction
fig, ax = plt.subplots()
ax.invert_xaxis()
ax.plot([-5, -3, 2, 4], [1, 2, -3, 5])
assert ax.get_xlim() == (4, -5)
... | def test_inverted_limits():
# Test gh:1553
# Calling invert_xaxis prior to plotting should not disable autoscaling
# while still maintaining the inverted direction
| fig, ax = plt.subplots()
ax.invert_xaxis()
ax.plot([-5, -3, 2, 4], [1, 2, -3, 5])
assert ax.get_xlim() == (4, -5)
assert ax.get_ylim() == (-3, 5)
plt.close()
fig, ax = plt.subplots()
ax.invert_yaxis()
ax.plot([-5, -3, 2, 4], [1, 2, -3, 5])
assert ax.get_xlim() == (... | y, bins='log', vmin=2, vmax=100)
assert h.get_clim() == (2, 100)
def test_inverted_limits():
# Test gh:1553
# Calling invert_xaxis prior to plotting should not disable autoscaling
# while still maintaining the inverted direction
| 67 | 67 | 226 | 38 | 29 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_inverted_limits | test_inverted_limits | 796 | 819 | 796 | 799 | 6faf3950a0667034d17bb7735d0bedc640bf5506 | bigcode/the-stack | train |
15a881819ea0e784f00a37f8 | train | function | @image_comparison(['violinplot_horiz_showmedians.png'])
def test_horiz_violinplot_showmedians():
ax = plt.axes()
# First 9 digits of frac(sqrt(23))
np.random.seed(795831523)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
... | @image_comparison(['violinplot_horiz_showmedians.png'])
def test_horiz_violinplot_showmedians():
| ax = plt.axes()
# First 9 digits of frac(sqrt(23))
np.random.seed(795831523)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
showextrema=0, showmedians=1)
| range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
showextrema=0, showmedians=0)
@image_comparison(['violinplot_horiz_showmedians.png'])
def test_horiz_violinplot_showmedians():
| 64 | 64 | 106 | 26 | 38 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_horiz_violinplot_showmedians | test_horiz_violinplot_showmedians | 3,143 | 3,150 | 3,143 | 3,144 | fc744a83b46d92055909d28904d9dffc524a5dff | bigcode/the-stack | train |
019bd8688ba737c6bff8feb3 | train | function | @image_comparison(['test_eventplot_problem_kwargs.png'], remove_text=True)
def test_eventplot_problem_kwargs(recwarn):
"""
test that 'singular' versions of LineCollection props raise an
MatplotlibDeprecationWarning rather than overriding the 'plural' versions
(e.g., to prevent 'color' from overridi... | @image_comparison(['test_eventplot_problem_kwargs.png'], remove_text=True)
def test_eventplot_problem_kwargs(recwarn):
| """
test that 'singular' versions of LineCollection props raise an
MatplotlibDeprecationWarning rather than overriding the 'plural' versions
(e.g., to prevent 'color' from overriding 'colors', see issue #4297)
"""
np.random.seed(0)
data1 = np.random.random([20]).tolist()
data2 =... | rgbk')
colors = colors[0]
collections = ax.eventplot(data, colors=colors)
for coll, color in zip(collections, expected):
assert_allclose(coll.get_color(), color)
@image_comparison(['test_eventplot_problem_kwargs.png'], remove_text=True)
def test_eventplot_problem_kwargs(recwarn):
| 69 | 69 | 233 | 25 | 44 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_eventplot_problem_kwargs | test_eventplot_problem_kwargs | 4,074 | 4,100 | 4,074 | 4,075 | a8e3bbee5549c9336c3adf29d5422a4ba30636d1 | bigcode/the-stack | train |
6865d7458be409267b81516b | train | function | @image_comparison(['hist_step_filled.png'], remove_text=True)
def test_hist_step_filled():
np.random.seed(0)
x = np.random.randn(1000, 3)
n_bins = 10
kwargs = [{'fill': True}, {'fill': False}, {'fill': None}, {}]*2
types = ['step']*4+['stepfilled']*4
fig, axs = plt.subplots(nrows=2, nco... | @image_comparison(['hist_step_filled.png'], remove_text=True)
def test_hist_step_filled():
| np.random.seed(0)
x = np.random.randn(1000, 3)
n_bins = 10
kwargs = [{'fill': True}, {'fill': False}, {'fill': None}, {}]*2
types = ['step']*4+['stepfilled']*4
fig, axs = plt.subplots(nrows=2, ncols=4)
for kg, _type, ax in zip(kwargs, types, axs.flat):
ax.hist(x, n_bins, h... | _text=True)
def test_hist_step_empty():
# From #3886: creating hist from empty dataset raises ValueError
ax = plt.gca()
ax.hist([], histtype='step')
@image_comparison(['hist_step_filled.png'], remove_text=True)
def test_hist_step_filled():
| 63 | 64 | 196 | 22 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_step_filled | test_hist_step_filled | 1,784 | 1,800 | 1,784 | 1,785 | 592dc96bec4f09fb1086b4430b2b47ac66536426 | bigcode/the-stack | train |
164dbd151223db08567ae9e1 | train | function | @check_figures_equal(extensions=["png"])
def test_matshow(fig_test, fig_ref):
mpl.style.use("mpl20")
a = np.random.rand(32, 32)
fig_test.add_subplot().matshow(a)
ax_ref = fig_ref.add_subplot()
ax_ref.imshow(a)
ax_ref.xaxis.tick_top()
ax_ref.xaxis.set_ticks_position('both')
| @check_figures_equal(extensions=["png"])
def test_matshow(fig_test, fig_ref):
| mpl.style.use("mpl20")
a = np.random.rand(32, 32)
fig_test.add_subplot().matshow(a)
ax_ref = fig_ref.add_subplot()
ax_ref.imshow(a)
ax_ref.xaxis.tick_top()
ax_ref.xaxis.set_ticks_position('both')
| interpolation': 'nearest'},
{'marker': 'o', 'linestyle': 'solid'}]:
with pytest.raises(TypeError):
ax.spy(np.eye(3, 3), **unsupported_kw)
@check_figures_equal(extensions=["png"])
def test_matshow(fig_test, fig_ref):
| 64 | 64 | 85 | 21 | 43 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_matshow | test_matshow | 156 | 164 | 156 | 157 | 77cb51d70358b8de8fc58b25855c10a20fc6ff97 | bigcode/the-stack | train |
caf4ddc646f2897fe40d57b8 | train | function | def test_set_ticks_inverted():
fig, ax = plt.subplots()
ax.invert_xaxis()
ax.set_xticks([.3, .7])
assert ax.get_xlim() == (1, 0)
| def test_set_ticks_inverted():
| fig, ax = plt.subplots()
ax.invert_xaxis()
ax.set_xticks([.3, .7])
assert ax.get_xlim() == (1, 0)
| = barcont.errorbar.lines
for bar in barcont.patches:
for capline in caplines:
assert capline.zorder > bar.zorder
for barlinecol in barlinecols:
assert barlinecol.zorder > bar.zorder
def test_set_ticks_inverted():
| 64 | 64 | 47 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_set_ticks_inverted | test_set_ticks_inverted | 6,793 | 6,797 | 6,793 | 6,793 | e1d953ba2a9d46cf4688120f64a206612ab3c75c | bigcode/the-stack | train |
55c0e6a7c74b8218a59f8aa0 | train | function | def test_subsampled_ticklabels():
# test issue 11937
fig, ax = plt.subplots()
ax.plot(np.arange(10))
ax.xaxis.set_ticks(np.arange(10) + 0.1)
ax.locator_params(nbins=5)
ax.xaxis.set_ticklabels([c for c in "bcdefghijk"])
plt.draw()
labels = [t.get_text() for t in ax.xaxis.get_tickl... | def test_subsampled_ticklabels():
# test issue 11937
| fig, ax = plt.subplots()
ax.plot(np.arange(10))
ax.xaxis.set_ticks(np.arange(10) + 0.1)
ax.locator_params(nbins=5)
ax.xaxis.set_ticklabels([c for c in "bcdefghijk"])
plt.draw()
labels = [t.get_text() for t in ax.xaxis.get_ticklabels()]
assert labels == ['b', 'd', 'f', 'h', 'j']
| ', 'c', 'd'], fontweight='bold')
ax.set_yticks([1, 3, 5])
ax.set_yticks([2, 4], ['A', 'B'], minor=True)
def test_subsampled_ticklabels():
# test issue 11937
| 64 | 64 | 120 | 16 | 48 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_subsampled_ticklabels | test_subsampled_ticklabels | 5,211 | 5,220 | 5,211 | 5,212 | 30a8bc97747d03ab3c29fd1125a613b5b5804e6e | bigcode/the-stack | train |
6f9787f876417ca90059c3e7 | train | function | def test_stairs_invalid_mismatch():
with pytest.raises(ValueError, match='Size mismatch'):
plt.stairs([1, 2], [0, 1])
| def test_stairs_invalid_mismatch():
| with pytest.raises(ValueError, match='Size mismatch'):
plt.stairs([1, 2], [0, 1])
| _ylim() == (-0.06, 0.06)
def test_stairs_invalid_nan():
with pytest.raises(ValueError, match='Nan values in "edges"'):
plt.stairs([1, 2], [0, np.nan, 1])
def test_stairs_invalid_mismatch():
| 63 | 64 | 36 | 8 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stairs_invalid_mismatch | test_stairs_invalid_mismatch | 1,998 | 2,000 | 1,998 | 1,998 | 642516af06d2c40be76c1a4ec2fae46d80573c06 | bigcode/the-stack | train |
e4c1d0aeaf3fc0e2246d64c4 | train | function | @check_figures_equal(extensions=['png'])
def test_twin_remove(fig_test, fig_ref):
ax_test = fig_test.add_subplot()
ax_twinx = ax_test.twinx()
ax_twiny = ax_test.twiny()
ax_twinx.remove()
ax_twiny.remove()
ax_ref = fig_ref.add_subplot()
# Ideally we also undo tick changes when calli... | @check_figures_equal(extensions=['png'])
def test_twin_remove(fig_test, fig_ref):
| ax_test = fig_test.add_subplot()
ax_twinx = ax_test.twinx()
ax_twiny = ax_test.twiny()
ax_twinx.remove()
ax_twiny.remove()
ax_ref = fig_ref.add_subplot()
# Ideally we also undo tick changes when calling ``remove()``, but for now
# manually set the ticks of the reference image to... | verted=True)
with np.errstate(divide="ignore"):
axs[0].psd(np.zeros(5))
axs[1].csd(np.zeros(5), np.zeros(5))
@check_figures_equal(extensions=['png'])
def test_twin_remove(fig_test, fig_ref):
| 63 | 64 | 124 | 21 | 42 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_twin_remove | test_twin_remove | 4,693 | 4,705 | 4,693 | 4,694 | 00c63686ad52c8862a93f89063bd639a7d247b8c | bigcode/the-stack | train |
9abe44d06cc0e883ca6be728 | train | function | @image_comparison(['eventplot', 'eventplot'], remove_text=True)
def test_eventplot():
np.random.seed(0)
data1 = np.random.random([32, 20]).tolist()
data2 = np.random.random([6, 20]).tolist()
data = data1 + data2
num_datasets = len(data)
colors1 = [[0, 1, .7]] * len(data1)
colors2... | @image_comparison(['eventplot', 'eventplot'], remove_text=True)
def test_eventplot():
| np.random.seed(0)
data1 = np.random.random([32, 20]).tolist()
data2 = np.random.random([6, 20]).tolist()
data = data1 + data2
num_datasets = len(data)
colors1 = [[0, 1, .7]] * len(data1)
colors2 = [[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
[1,... | alpha=.5)
# everything alpha=.5 by colors
ax.plot(data + 6, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0, .5],
markersize=20, lw=10)
# alpha=.5 line, solid markers
ax.plot(data + 8, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0],
markersize=20, lw=10)
@image_comparison... | 138 | 138 | 461 | 21 | 117 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_eventplot | test_eventplot | 3,987 | 4,028 | 3,987 | 3,988 | 028c842acf624c9f42138965a1b14e15d5b2b349 | bigcode/the-stack | train |
59ea726d7b388e4702caca3f | train | function | @pytest.mark.parametrize("histtype, zorder",
[("bar", mpl.patches.Patch.zorder),
("step", mpl.lines.Line2D.zorder),
("stepfilled", mpl.patches.Patch.zorder)])
def test_hist_zorder(histtype, zorder):
ax = plt.figure().add_subplot()
... | @pytest.mark.parametrize("histtype, zorder",
[("bar", mpl.patches.Patch.zorder),
("step", mpl.lines.Line2D.zorder),
("stepfilled", mpl.patches.Patch.zorder)])
def test_hist_zorder(histtype, zorder):
| ax = plt.figure().add_subplot()
ax.hist([1, 2], histtype=histtype)
assert ax.patches
for patch in ax.patches:
assert patch.get_zorder() == zorder
| _of_hists
@pytest.mark.parametrize("histtype, zorder",
[("bar", mpl.patches.Patch.zorder),
("step", mpl.lines.Line2D.zorder),
("stepfilled", mpl.patches.Patch.zorder)])
def test_hist_zorder(histtype, zorder):
| 64 | 64 | 109 | 60 | 3 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_zorder | test_hist_zorder | 1,867 | 1,876 | 1,867 | 1,871 | 246bbe844a980bcaf8b8d3434535a90e82c54d4e | bigcode/the-stack | train |
58b70e4d868a1263a8e22e08 | train | function | def test_titletwiny():
plt.style.use('mpl20')
fig, ax = plt.subplots(dpi=72)
ax2 = ax.twiny()
xlabel2 = ax2.set_xlabel('Xlabel2')
title = ax.set_title('Title')
fig.canvas.draw()
renderer = fig.canvas.get_renderer()
# ------- Test that title is put above Xlabel2 (Xlabel2 at top) -... | def test_titletwiny():
| plt.style.use('mpl20')
fig, ax = plt.subplots(dpi=72)
ax2 = ax.twiny()
xlabel2 = ax2.set_xlabel('Xlabel2')
title = ax.set_title('Title')
fig.canvas.draw()
renderer = fig.canvas.get_renderer()
# ------- Test that title is put above Xlabel2 (Xlabel2 at top) ----------
bbox_y0_t... | ')
ax.add_patch(circ)
ax.grid(color='c', linestyle='-', linewidth=3)
ax.tick_params(top=False, bottom=False,
left=False, right=False)
ax.spines[:].set_visible(False)
ax.set_axisbelow(setting)
def test_titletwiny():
| 64 | 64 | 161 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_titletwiny | test_titletwiny | 6,001 | 6,013 | 6,001 | 6,001 | 9a3b26c43b2a230c2b800423690a180b8e958a53 | bigcode/the-stack | train |
eac3975a63d8d18006134ac8 | train | function | def test_bar_color_cycle():
to_rgb = mcolors.to_rgb
fig, ax = plt.subplots()
for j in range(5):
ln, = ax.plot(range(3))
brs = ax.bar(range(3), range(3))
for br in brs:
assert to_rgb(ln.get_color()) == to_rgb(br.get_facecolor())
| def test_bar_color_cycle():
| to_rgb = mcolors.to_rgb
fig, ax = plt.subplots()
for j in range(5):
ln, = ax.plot(range(3))
brs = ax.bar(range(3), range(3))
for br in brs:
assert to_rgb(ln.get_color()) == to_rgb(br.get_facecolor())
| for i in range(0, 60, 10)]
y = np.linspace(0, 5, len(dates))
u = v = np.linspace(0, 50, len(dates))
ax.quiver(dates, y, u, v)
def test_bar_color_cycle():
| 64 | 64 | 79 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_color_cycle | test_bar_color_cycle | 6,104 | 6,111 | 6,104 | 6,104 | 6505e9d20821fc416d4b26961a04062f7729ec6b | bigcode/the-stack | train |
3c8f37c211f2f9d7182737f5 | train | function | @image_comparison(['errorbar_limits'])
def test_errorbar_limits():
x = np.arange(0.5, 5.5, 0.5)
y = np.exp(-x)
xerr = 0.1
yerr = 0.2
ls = 'dotted'
fig, ax = plt.subplots()
# standard error bars
ax.errorbar(x, y, xerr=xerr, yerr=yerr, ls=ls, color='blue')
# including u... | @image_comparison(['errorbar_limits'])
def test_errorbar_limits():
| x = np.arange(0.5, 5.5, 0.5)
y = np.exp(-x)
xerr = 0.1
yerr = 0.2
ls = 'dotted'
fig, ax = plt.subplots()
# standard error bars
ax.errorbar(x, y, xerr=xerr, yerr=yerr, ls=ls, color='blue')
# including upper limits
uplims = np.zeros_like(x)
uplims[[1, 5, 9]] = T... | y = np.exp(-x)
yerr1 = 0.1 + 0.2*np.sqrt(x)
yerr = np.vstack((yerr1, 2*yerr1)).T
xerr = 0.1 + yerr
with pytest.raises(ValueError):
ax.errorbar(x, y, yerr=yerr, fmt='o')
with pytest.raises(ValueError):
ax.errorbar(x, y, xerr=xerr, fmt='o')
with pytest.raises(ValueErr... | 149 | 150 | 503 | 15 | 134 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_errorbar_limits | test_errorbar_limits | 3,404 | 3,448 | 3,404 | 3,405 | 0dd915054f990c260cb44f44b5bbe62a2f8e3587 | bigcode/the-stack | train |
3caa4075cc0d82fbe77a31d3 | train | function | @image_comparison(['violinplot_horiz_baseline.png'])
def test_horiz_violinplot_baseline():
ax = plt.axes()
# First 9 digits of frac(sqrt(19))
np.random.seed(358898943)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
... | @image_comparison(['violinplot_horiz_baseline.png'])
def test_horiz_violinplot_baseline():
| ax = plt.axes()
# First 9 digits of frac(sqrt(19))
np.random.seed(358898943)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
showextrema=0, showmedians=0)
| in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
showmedians=0, points=200)
@image_comparison(['violinplot_horiz_baseline.png'])
def test_horiz_violinplot_baseline():
| 64 | 64 | 104 | 24 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_horiz_violinplot_baseline | test_horiz_violinplot_baseline | 3,133 | 3,140 | 3,133 | 3,134 | 4bf569e45abbb26c16bec2caeed2528c1ec6a324 | bigcode/the-stack | train |
81c0bc3acac2344efb7e5f4e | train | function | @image_comparison(['violinplot_vert_custompoints_10.png'])
def test_vert_violinplot_custompoints_10():
ax = plt.axes()
# First 9 digits of frac(sqrt(13))
np.random.seed(605551275)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showext... | @image_comparison(['violinplot_vert_custompoints_10.png'])
def test_vert_violinplot_custompoints_10():
| ax = plt.axes()
# First 9 digits of frac(sqrt(13))
np.random.seed(605551275)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
showmedians=0, points=10)
| 1, 0.9], [0.2, 0.8], [0.3, 0.7], [0.4, 0.6]])
@image_comparison(['violinplot_vert_custompoints_10.png'])
def test_vert_violinplot_custompoints_10():
| 63 | 64 | 107 | 26 | 37 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_vert_violinplot_custompoints_10 | test_vert_violinplot_custompoints_10 | 3,113 | 3,120 | 3,113 | 3,114 | 1e2c4592fe706b7df235bf831cbfaa823abc43a0 | bigcode/the-stack | train |
0652ff1cf0a5b6752b27fea9 | train | function | @image_comparison(['bxp_horizontal.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default',
tol=0.1)
def test_bxp_horizontal():
_bxp_test_helper(bxp_kwargs=dict(vert=False))
| @image_comparison(['bxp_horizontal.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default',
tol=0.1)
def test_bxp_horizontal():
| _bxp_test_helper(bxp_kwargs=dict(vert=False))
| label'] = label
return stats
_bxp_test_helper(transform_stats=transform)
@image_comparison(['bxp_horizontal.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default',
tol=0.1)
def test_bxp_horizontal():
| 64 | 64 | 58 | 44 | 20 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_horizontal | test_bxp_horizontal | 2,645 | 2,651 | 2,645 | 2,650 | aca2b85238e73aa54f87cfcb65fc7d7aa9ee8ca1 | bigcode/the-stack | train |
afc9a28d8d8bbbf060b1822f | train | function | @image_comparison(['vertex_markers.png'], remove_text=True)
def test_vertex_markers():
data = list(range(10))
marker_as_tuple = ((-1, -1), (1, -1), (1, 1), (-1, 1))
marker_as_list = [(-1, -1), (1, -1), (1, 1), (-1, 1)]
fig, ax = plt.subplots()
ax.plot(data, linestyle='', marker=marker_as_tuple... | @image_comparison(['vertex_markers.png'], remove_text=True)
def test_vertex_markers():
| data = list(range(10))
marker_as_tuple = ((-1, -1), (1, -1), (1, 1), (-1, 1))
marker_as_list = [(-1, -1), (1, -1), (1, 1), (-1, 1)]
fig, ax = plt.subplots()
ax.plot(data, linestyle='', marker=marker_as_tuple, mfc='k')
ax.plot(data[::-1], linestyle='', marker=marker_as_list, mfc='b')
ax... | enumerate(
[('top', 's'), ('bottom', 'o'), ('none', '^')]):
matplotlib.rcParams['markers.fillstyle'] = style
ax.plot(x+idx, marker=marker)
@image_comparison(['vertex_markers.png'], remove_text=True)
def test_vertex_markers():
| 64 | 64 | 154 | 20 | 44 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_vertex_markers | test_vertex_markers | 4,153 | 4,162 | 4,153 | 4,154 | 68ee3eaa07fd61b936386107f08d3159b4a2b9c5 | bigcode/the-stack | train |
5c87770042534e215c7a89d2 | train | function | def test_aspect_nonlinear_adjustable_box():
fig = plt.figure(figsize=(10, 10)) # Square.
ax = fig.add_subplot()
ax.plot([.4, .6], [.4, .6]) # Set minpos to keep logit happy.
ax.set(xscale="log", xlim=(1, 10),
yscale="logit", ylim=(1/11, 1/1001),
aspect=1, adjustable="box"... | def test_aspect_nonlinear_adjustable_box():
| fig = plt.figure(figsize=(10, 10)) # Square.
ax = fig.add_subplot()
ax.plot([.4, .6], [.4, .6]) # Set minpos to keep logit happy.
ax.set(xscale="log", xlim=(1, 10),
yscale="logit", ylim=(1/11, 1/1001),
aspect=1, adjustable="box")
ax.margins(0)
pos = fig.transFigu... | order > bar.zorder
def test_set_ticks_inverted():
fig, ax = plt.subplots()
ax.invert_xaxis()
ax.set_xticks([.3, .7])
assert ax.get_xlim() == (1, 0)
def test_aspect_nonlinear_adjustable_box():
| 64 | 64 | 139 | 11 | 53 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_aspect_nonlinear_adjustable_box | test_aspect_nonlinear_adjustable_box | 6,800 | 6,810 | 6,800 | 6,800 | 594f10375a635d02956b5490e41d12c7686c2840 | bigcode/the-stack | train |
2b80b961a838c165fa5a1280 | train | function | @image_comparison(['violinplot_vert_custompoints_200.png'])
def test_vert_violinplot_custompoints_200():
ax = plt.axes()
# First 9 digits of frac(sqrt(17))
np.random.seed(123105625)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showe... | @image_comparison(['violinplot_vert_custompoints_200.png'])
def test_vert_violinplot_custompoints_200():
| ax = plt.axes()
# First 9 digits of frac(sqrt(17))
np.random.seed(123105625)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
showmedians=0, points=200)
| (4)]
ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
showmedians=0, points=10)
@image_comparison(['violinplot_vert_custompoints_200.png'])
def test_vert_violinplot_custompoints_200():
| 64 | 64 | 107 | 26 | 38 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_vert_violinplot_custompoints_200 | test_vert_violinplot_custompoints_200 | 3,123 | 3,130 | 3,123 | 3,124 | 5b88bea48f6e0ba2d72e8dcd82cc33f4fa1aa862 | bigcode/the-stack | train |
f32393add5b26952efb62372 | train | function | def test_nan_bar_values():
fig, ax = plt.subplots()
ax.bar([0, 1], [np.nan, 4])
| def test_nan_bar_values():
| fig, ax = plt.subplots()
ax.bar([0, 1], [np.nan, 4])
| above for a labeled data test
data = {"a": 0, "b": 1}
fig, ax = plt.subplots()
ax = plt.gca()
ax.bar("a", "b", align='edge', tick_label='0', data=data)
def test_nan_bar_values():
| 64 | 64 | 30 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_nan_bar_values | test_nan_bar_values | 1,513 | 1,515 | 1,513 | 1,513 | e75b76e9149bd806766c2bbe456b84e76c0d40ef | bigcode/the-stack | train |
233564dfac22f08bc952345f | train | function | @image_comparison(['hist_stacked_stepfilled_alpha'])
def test_hist_stacked_stepfilled_alpha():
# make some data
d1 = np.linspace(1, 3, 20)
d2 = np.linspace(0, 10, 50)
fig, ax = plt.subplots()
ax.hist((d1, d2), histtype="stepfilled", stacked=True, alpha=0.5)
| @image_comparison(['hist_stacked_stepfilled_alpha'])
def test_hist_stacked_stepfilled_alpha():
# make some data
| d1 = np.linspace(1, 3, 20)
d2 = np.linspace(0, 10, 50)
fig, ax = plt.subplots()
ax.hist((d1, d2), histtype="stepfilled", stacked=True, alpha=0.5)
| .cos(x),
linefmt='C2-.', markerfmt='kx', basefmt='C1-.',
use_line_collection=use_line_collection, orientation='horizontal')
@image_comparison(['hist_stacked_stepfilled_alpha'])
def test_hist_stacked_stepfilled_alpha():
# make some data
| 63 | 64 | 90 | 27 | 36 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stacked_stepfilled_alpha | test_hist_stacked_stepfilled_alpha | 3,670 | 3,676 | 3,670 | 3,672 | 6c7dfc2ae00408addedb34da52c2c5d89ed58786 | bigcode/the-stack | train |
bbd4c515d3e17f05011359aa | train | function | def test_none_kwargs():
ax = plt.figure().subplots()
ln, = ax.plot(range(32), linestyle=None)
assert ln.get_linestyle() == '-'
| def test_none_kwargs():
| ax = plt.figure().subplots()
ln, = ax.plot(range(32), linestyle=None)
assert ln.get_linestyle() == '-'
| is False
assert ax.xaxis.majorTicks[0].label2.get_visible() is True
assert ax.xaxis.minorTicks[0].label1.get_visible() is False
assert ax.xaxis.minorTicks[0].label2.get_visible() is True
def test_none_kwargs():
| 64 | 64 | 37 | 5 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_none_kwargs | test_none_kwargs | 5,917 | 5,920 | 5,917 | 5,917 | 57ecb4596e0e7cd8a6738f07dc79095a75cfee60 | bigcode/the-stack | train |
5ea950a8660cf6b84d89de10 | train | function | def test_pandas_minimal_plot(pd):
# smoke test that series and index objcets do not warn
x = pd.Series([1, 2], dtype="float64")
plt.plot(x, x)
plt.plot(x.index, x)
plt.plot(x)
plt.plot(x.index)
| def test_pandas_minimal_plot(pd):
# smoke test that series and index objcets do not warn
| x = pd.Series([1, 2], dtype="float64")
plt.plot(x, x)
plt.plot(x.index, x)
plt.plot(x)
plt.plot(x.index)
| ']
for i in range(2):
ax_ref.bar(x[i], y[i], color='C0', hatch=hatches[i])
ax_test.bar(x, y, hatch=hatches)
def test_pandas_minimal_plot(pd):
# smoke test that series and index objcets do not warn
| 64 | 64 | 65 | 23 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pandas_minimal_plot | test_pandas_minimal_plot | 1,727 | 1,733 | 1,727 | 1,728 | 8853f1b6404d066f02d7a6ff686491404a0fdd73 | bigcode/the-stack | train |
d019cdf5d64290befd264b13 | train | function | def test_shared_with_aspect_3():
# Different aspect ratios:
for adjustable in ['box', 'datalim']:
fig, axs = plt.subplots(nrows=2, sharey=True)
axs[0].set_aspect(2, adjustable=adjustable)
axs[1].set_aspect(0.5, adjustable=adjustable)
axs[0].plot([1, 2], [3, 4])
axs... | def test_shared_with_aspect_3():
# Different aspect ratios:
| for adjustable in ['box', 'datalim']:
fig, axs = plt.subplots(nrows=2, sharey=True)
axs[0].set_aspect(2, adjustable=adjustable)
axs[1].set_aspect(0.5, adjustable=adjustable)
axs[0].plot([1, 2], [3, 4])
axs[1].plot([3, 4], [1, 2])
plt.draw() # Trigger apply_aspe... | plot([3, 4], [1, 2])
plt.draw() # Trigger apply_aspect().
assert axs[0].get_xlim() == axs[1].get_xlim()
assert axs[0].get_ylim() == axs[1].get_ylim()
def test_shared_with_aspect_3():
# Different aspect ratios:
| 74 | 74 | 249 | 15 | 59 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_shared_with_aspect_3 | test_shared_with_aspect_3 | 4,908 | 4,925 | 4,908 | 4,909 | 5722a4ca11fc5038775b7dfd5cda03410c593fb1 | bigcode/the-stack | train |
4fe255933f644fa1795ed605 | train | function | @pytest.mark.parametrize("grid_which, major_visible, minor_visible", [
("both", True, True),
("major", True, False),
("minor", False, True),
])
def test_rcparam_grid_minor(grid_which, major_visible, minor_visible):
mpl.rcParams.update({"axes.grid": True, "axes.grid.which": grid_which})
fig, a... | @pytest.mark.parametrize("grid_which, major_visible, minor_visible", [
("both", True, True),
("major", True, False),
("minor", False, True),
])
def test_rcparam_grid_minor(grid_which, major_visible, minor_visible):
| mpl.rcParams.update({"axes.grid": True, "axes.grid.which": grid_which})
fig, ax = plt.subplots()
fig.canvas.draw()
assert all(tick.gridline.get_visible() == major_visible
for tick in ax.xaxis.majorTicks)
assert all(tick.gridline.get_visible() == minor_visible
for ... | ', alpha=.5, data=data)
@pytest.mark.parametrize("grid_which, major_visible, minor_visible", [
("both", True, True),
("major", True, False),
("minor", False, True),
])
def test_rcparam_grid_minor(grid_which, major_visible, minor_visible):
| 64 | 64 | 138 | 56 | 8 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_rcparam_grid_minor | test_rcparam_grid_minor | 4,784 | 4,796 | 4,784 | 4,789 | 98d983d8dae95939601a03c1e900be8ffca84e35 | bigcode/the-stack | train |
c54f1e7a19d898136a0606c5 | train | function | def test_stairs_empty():
ax = plt.figure().add_subplot()
ax.stairs([], [42])
assert ax.get_xlim() == (39, 45)
assert ax.get_ylim() == (-0.06, 0.06)
| def test_stairs_empty():
| ax = plt.figure().add_subplot()
ax.stairs([], [42])
assert ax.get_xlim() == (39, 45)
assert ax.get_ylim() == (-0.06, 0.06)
| {'solid_joinstyle': 'miter', 'solid_capstyle': 'butt'}
ref_ax.plot(range(4), [5, 6, 7, 7], drawstyle='steps-post', **style)
ref_ax.set_ylim(0, None)
def test_stairs_empty():
| 64 | 64 | 53 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stairs_empty | test_stairs_empty | 1,986 | 1,990 | 1,986 | 1,986 | 4d5410da772aaf42873ac2d8936c30be4e19d8af | bigcode/the-stack | train |
c72b304558a2dd7675503761 | train | function | @pytest.mark.parametrize(
'kwargs, expected_edgecolors',
[(dict(), None),
(dict(c='b'), None),
(dict(edgecolors='r'), 'r'),
(dict(edgecolors=['r', 'g']), ['r', 'g']),
(dict(edgecolor='r'), 'r'),
(dict(edgecolors='face'), 'face'),
(dict(edgecolors='none'), 'none'),
(di... | @pytest.mark.parametrize(
'kwargs, expected_edgecolors',
[(dict(), None),
(dict(c='b'), None),
(dict(edgecolors='r'), 'r'),
(dict(edgecolors=['r', 'g']), ['r', 'g']),
(dict(edgecolor='r'), 'r'),
(dict(edgecolors='face'), 'face'),
(dict(edgecolors='none'), 'none'),
(di... | def get_next_color():
return 'blue' # currently unused
c = kwargs.pop('c', None)
edgecolors = kwargs.pop('edgecolors', None)
_, _, result_edgecolors = \
mpl.axes.Axes._parse_scatter_color_args(
c, edgecolors, kwargs, xsize=2, get_next_color_func=get_next_color)
... | @pytest.mark.parametrize(
'kwargs, expected_edgecolors',
[(dict(), None),
(dict(c='b'), None),
(dict(edgecolors='r'), 'r'),
(dict(edgecolors=['r', 'g']), ['r', 'g']),
(dict(edgecolor='r'), 'r'),
(dict(edgecolors='face'), 'face'),
(dict(edgecolors='none'), 'none'),
(di... | 168 | 77 | 257 | 168 | 0 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_parse_scatter_color_args_edgecolors | test_parse_scatter_color_args_edgecolors | 2,416 | 2,439 | 2,416 | 2,430 | 574177cbc01b0ed2c37adc7bc18916ca321e54a1 | bigcode/the-stack | train |
26879906c9d8f2f052d2edd7 | train | function | @image_comparison(['mixed_collection'], remove_text=True)
def test_mixed_collection():
# First illustrate basic pyplot interface, using defaults where possible.
fig, ax = plt.subplots()
c = mpatches.Circle((8, 8), radius=4, facecolor='none', edgecolor='green')
# PDF can optimize this one
p... | @image_comparison(['mixed_collection'], remove_text=True)
def test_mixed_collection():
# First illustrate basic pyplot interface, using defaults where possible.
| fig, ax = plt.subplots()
c = mpatches.Circle((8, 8), radius=4, facecolor='none', edgecolor='green')
# PDF can optimize this one
p1 = mpl.collections.PatchCollection([c], match_original=True)
p1.set_offsets([[0, 0], [24, 24]])
p1.set_linewidths([1, 5])
# PDF can't optimize this on... | data=data)
ax.step("X", "Y2", lw=5, linestyle=ls, where='post', data=data)
ax.set_xlim([-1, 5])
ax.set_ylim([-1, 7])
@image_comparison(['mixed_collection'], remove_text=True)
def test_mixed_collection():
# First illustrate basic pyplot interface, using defaults where possible.
| 79 | 80 | 267 | 31 | 48 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_mixed_collection | test_mixed_collection | 4,430 | 4,453 | 4,430 | 4,432 | b6ba8421376bd990c4cc5b6e92553135d81b99fa | bigcode/the-stack | train |
be924be95639e9094c0f0964 | train | function | @image_comparison(['pie_linewidth_0', 'pie_linewidth_0', 'pie_linewidth_0'],
extensions=['png'])
def test_pie_linewidth_0():
# The slices will be ordered and plotted counter-clockwise.
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
colors = ['yellowgreen', 'gol... | @image_comparison(['pie_linewidth_0', 'pie_linewidth_0', 'pie_linewidth_0'],
extensions=['png'])
def test_pie_linewidth_0():
# The slices will be ordered and plotted counter-clockwise.
| labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
plt.pie(sizes, explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', ... | the 2nd slice (i.e. 'Hogs')
fig1, ax1 = plt.subplots(figsize=(8, 6))
ax1.pie(sizes, explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True, startangle=90)
@image_comparison(['pie_linewidth_0', 'pie_linewidth_0', 'pie_linewidth_0'],
extensions=['png'])
d... | 119 | 119 | 399 | 52 | 67 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pie_linewidth_0 | test_pie_linewidth_0 | 4,986 | 5,016 | 4,986 | 4,989 | cfbd93dccb58fa9888fbb47b74a1a1a2c6569609 | bigcode/the-stack | train |
23b1ae329381f842ef0b516c | train | function | def test_pathological_hexbin():
# issue #2863
mylist = [10] * 100
fig, ax = plt.subplots(1, 1)
ax.hexbin(mylist, mylist)
fig.savefig(io.BytesIO()) # Check that no warning is emitted.
| def test_pathological_hexbin():
# issue #2863
| mylist = [10] * 100
fig, ax = plt.subplots(1, 1)
ax.hexbin(mylist, mylist)
fig.savefig(io.BytesIO()) # Check that no warning is emitted.
| (xscale="log", xmargin=0)
assert ax.get_xlim() == (1, 2)
def test_length_one_hist():
fig, ax = plt.subplots()
ax.hist(1)
ax.hist([1])
def test_pathological_hexbin():
# issue #2863
| 63 | 64 | 64 | 14 | 49 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pathological_hexbin | test_pathological_hexbin | 5,327 | 5,332 | 5,327 | 5,328 | a7d4b86cb20f32ad3b6ad37c976152562e74d54a | bigcode/the-stack | train |
18e35b65175fcbb5efc5d369 | train | function | @image_comparison(['bxp_no_flier_stats.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_no_flier_stats():
def transform(stats):
for s in stats:
s.pop('fliers', None)
return stats
_bxp_te... | @image_comparison(['bxp_no_flier_stats.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_no_flier_stats():
| def transform(stats):
for s in stats:
s.pop('fliers', None)
return stats
_bxp_test_helper(transform_stats=transform,
bxp_kwargs=dict(showfliers=False))
| test_bxp_nobox():
_bxp_test_helper(bxp_kwargs=dict(showbox=False))
@image_comparison(['bxp_no_flier_stats.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_no_flier_stats():
| 63 | 64 | 88 | 43 | 20 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_no_flier_stats | test_bxp_no_flier_stats | 2,765 | 2,776 | 2,765 | 2,769 | 327b0b0bd6fec12dffe71027fa09374065702849 | bigcode/the-stack | train |
4b6877defe24c16ba0f3e822 | train | function | @check_figures_equal(extensions=['png'])
def test_errorbar_with_prop_cycle(fig_test, fig_ref):
ax = fig_ref.subplots()
ax.errorbar(x=[2, 4, 10], y=[0, 1, 2], yerr=0.5,
ls='--', marker='s', mfc='k')
ax.errorbar(x=[2, 4, 10], y=[2, 3, 4], yerr=0.5, color='tab:green',
ls='... | @check_figures_equal(extensions=['png'])
def test_errorbar_with_prop_cycle(fig_test, fig_ref):
| ax = fig_ref.subplots()
ax.errorbar(x=[2, 4, 10], y=[0, 1, 2], yerr=0.5,
ls='--', marker='s', mfc='k')
ax.errorbar(x=[2, 4, 10], y=[2, 3, 4], yerr=0.5, color='tab:green',
ls=':', marker='s', mfc='y')
ax.errorbar(x=[2, 4, 10], y=[4, 5, 6], yerr=0.5, fmt='tab:blue',
... | =1, yerr=1, ls='None',
marker='s', fillstyle='full',
drawstyle='steps-mid',
dash_capstyle='round',
dash_joinstyle='miter',
solid_capstyle='butt',... | 108 | 109 | 366 | 23 | 85 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_errorbar_with_prop_cycle | test_errorbar_with_prop_cycle | 3,479 | 3,497 | 3,479 | 3,480 | d265a1e2a2c7b8c3b1490dd864a60d4ae54b82bd | bigcode/the-stack | train |
8b4ada0c2af74e71c298f99c | train | function | @image_comparison(['boxplot_with_CIarray.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_with_CIarray():
# Randomness used for bootstrapping.
np.random.seed(937)
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig, ax = plt.sub... | @image_comparison(['boxplot_with_CIarray.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_with_CIarray():
# Randomness used for bootstrapping.
| np.random.seed(937)
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig, ax = plt.subplots()
CIs = np.array([[-1.5, 3.], [-1., 3.5]])
# show a boxplot with Matplotlib medians and confidence intervals, and
# another with manual values
ax.boxplot([x, x], bootstrap=10000,... | ) for t in ax[1].get_children()])
@image_comparison(['boxplot_with_CIarray.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_with_CIarray():
# Randomness used for bootstrapping.
| 62 | 64 | 189 | 51 | 12 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_with_CIarray | test_boxplot_with_CIarray | 2,969 | 2,984 | 2,969 | 2,972 | 92a2f1b003498bb1cb586b3e9aef7b5b142c6c8b | bigcode/the-stack | train |
12523996ee73a4da0e519ee1 | train | function | @check_figures_equal(extensions=["png"])
def test_axis_bool_arguments(fig_test, fig_ref):
# Test if False and "off" give the same
fig_test.add_subplot(211).axis(False)
fig_ref.add_subplot(211).axis("off")
# Test if True after False gives the same as "on"
ax = fig_test.add_subplot(212)
ax.... | @check_figures_equal(extensions=["png"])
def test_axis_bool_arguments(fig_test, fig_ref):
# Test if False and "off" give the same
| fig_test.add_subplot(211).axis(False)
fig_ref.add_subplot(211).axis("off")
# Test if True after False gives the same as "on"
ax = fig_test.add_subplot(212)
ax.axis(False)
ax.axis(True)
fig_ref.add_subplot(212).axis("on")
| [n])
assert_allclose(
bbspines[n * 2].bounds, targetbb.bounds, atol=1e-2)
@check_figures_equal(extensions=["png"])
def test_axis_bool_arguments(fig_test, fig_ref):
# Test if False and "off" give the same
| 64 | 64 | 104 | 35 | 29 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axis_bool_arguments | test_axis_bool_arguments | 6,710 | 6,719 | 6,710 | 6,712 | e998ab5b843f4e4452bf78f4b6fcf5940a949168 | bigcode/the-stack | train |
c3320c354775c66456021cb8 | train | function | @pytest.mark.parametrize('xscale', ['symlog', 'log'])
@pytest.mark.parametrize('yscale', ['symlog', 'log'])
def test_minorticks_on(xscale, yscale):
ax = plt.subplot()
ax.plot([1, 2, 3, 4])
ax.set_xscale(xscale)
ax.set_yscale(yscale)
ax.minorticks_on()
| @pytest.mark.parametrize('xscale', ['symlog', 'log'])
@pytest.mark.parametrize('yscale', ['symlog', 'log'])
def test_minorticks_on(xscale, yscale):
| ax = plt.subplot()
ax.plot([1, 2, 3, 4])
ax.set_xscale(xscale)
ax.set_yscale(yscale)
ax.minorticks_on()
| ylim(np.inf)
# Test all 4 combinations of logs/symlogs for minorticks_on()
@pytest.mark.parametrize('xscale', ['symlog', 'log'])
@pytest.mark.parametrize('yscale', ['symlog', 'log'])
def test_minorticks_on(xscale, yscale):
| 64 | 64 | 88 | 42 | 22 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_minorticks_on | test_minorticks_on | 6,216 | 6,223 | 6,216 | 6,218 | 161f4146adb5ea7596a7672619fd2c16a2112c8a | bigcode/the-stack | train |
91703528580eb5bfc2cc0401 | train | function | @pytest.mark.parametrize('data', [[1, 2, 3, np.nan, 5],
np.ma.masked_equal([1, 2, 3, 4, 5], 4)])
@check_figures_equal(extensions=["png"])
def test_lines_with_colors(fig_test, fig_ref, data):
test_colors = ['red', 'green', 'blue', 'purple', 'orange']
fig_test.add_subplot(2,... | @pytest.mark.parametrize('data', [[1, 2, 3, np.nan, 5],
np.ma.masked_equal([1, 2, 3, 4, 5], 4)])
@check_figures_equal(extensions=["png"])
def test_lines_with_colors(fig_test, fig_ref, data):
| test_colors = ['red', 'green', 'blue', 'purple', 'orange']
fig_test.add_subplot(2, 1, 1).vlines(data, 0, 1,
colors=test_colors, linewidth=5)
fig_test.add_subplot(2, 1, 2).hlines(data, 0, 1,
colors=test_colors, linewidth=5)... | .get_color(), 'red')
@pytest.mark.parametrize('data', [[1, 2, 3, np.nan, 5],
np.ma.masked_equal([1, 2, 3, 4, 5], 4)])
@check_figures_equal(extensions=["png"])
def test_lines_with_colors(fig_test, fig_ref, data):
| 76 | 77 | 257 | 70 | 6 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_lines_with_colors | test_lines_with_colors | 4,382 | 4,397 | 4,382 | 4,385 | 60a9cd27152e4a571e598242bb1c5d1868a44918 | bigcode/the-stack | train |
952ecc2e7353c4c0dac99ed0 | train | function | def test_shared_axes_retick():
fig, axs = plt.subplots(2, 2, sharex='all', sharey='all')
for ax in axs.flat:
ax.plot([0, 2], 'o-')
axs[0, 0].set_xticks([-0.5, 0, 1, 1.5]) # should affect all axes xlims
for ax in axs.flat:
assert ax.get_xlim() == axs[0, 0].get_xlim()
axs... | def test_shared_axes_retick():
| fig, axs = plt.subplots(2, 2, sharex='all', sharey='all')
for ax in axs.flat:
ax.plot([0, 2], 'o-')
axs[0, 0].set_xticks([-0.5, 0, 1, 1.5]) # should affect all axes xlims
for ax in axs.flat:
assert ax.get_xlim() == axs[0, 0].get_xlim()
axs[0, 0].set_yticks([-0.5, 0, 2, 2... | , sharey=True)
for ax in axs.flat:
ax.plot(x, y)
axs = fig_test.subplots(2, 2, sharex=True, sharey=True)
for ax in axs.flat:
ax.clear()
ax.plot(x, y)
def test_shared_axes_retick():
| 64 | 64 | 171 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_shared_axes_retick | test_shared_axes_retick | 7,045 | 7,057 | 7,045 | 7,045 | 3244b71cd69191ce9653264bfdf00de15b8c7622 | bigcode/the-stack | train |
fb4350a7845329077ca2e53f | train | function | @check_figures_equal(extensions=["png"])
def test_minorticks_on_rcParams_both(fig_test, fig_ref):
with matplotlib.rc_context({"xtick.minor.visible": True,
"ytick.minor.visible": True}):
ax_test = fig_test.subplots()
ax_test.plot([0, 1], [0, 1])
ax_ref = fig_... | @check_figures_equal(extensions=["png"])
def test_minorticks_on_rcParams_both(fig_test, fig_ref):
| with matplotlib.rc_context({"xtick.minor.visible": True,
"ytick.minor.visible": True}):
ax_test = fig_test.subplots()
ax_test.plot([0, 1], [0, 1])
ax_ref = fig_ref.subplots()
ax_ref.plot([0, 1], [0, 1])
ax_ref.minorticks_on()
| .imshow(img)
ax1.plot(x, np.cos(x))
ax1.cla()
assert ax.yaxis_inverted()
# clean up
plt.close(fig)
@check_figures_equal(extensions=["png"])
def test_minorticks_on_rcParams_both(fig_test, fig_ref):
| 64 | 64 | 108 | 27 | 37 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_minorticks_on_rcParams_both | test_minorticks_on_rcParams_both | 440 | 448 | 440 | 441 | a06320441f452e88380b926efb35e493c134f480 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.