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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9943a7e6d593670c4a417173 | train | function | @image_comparison(['date_timezone_x_and_y.png'], tol=1.0)
def test_date_timezone_x_and_y():
# Tests issue 5575
UTC = datetime.timezone.utc
time_index = [datetime.datetime(2016, 2, 22, hour=x, tzinfo=UTC)
for x in range(3)]
# Same Timezone
plt.figure(figsize=(20, 12))
... | @image_comparison(['date_timezone_x_and_y.png'], tol=1.0)
def test_date_timezone_x_and_y():
# Tests issue 5575
| UTC = datetime.timezone.utc
time_index = [datetime.datetime(2016, 2, 22, hour=x, tzinfo=UTC)
for x in range(3)]
# Same Timezone
plt.figure(figsize=(20, 12))
plt.subplot(2, 1, 1)
plt.plot_date(time_index, time_index, tz='UTC', ydate=True)
# Different Timezone
... | , 2)
plt.plot_date([3] * 3, time_index, tz='UTC', xdate=False, ydate=True)
@image_comparison(['date_timezone_x_and_y.png'], tol=1.0)
def test_date_timezone_x_and_y():
# Tests issue 5575
| 64 | 64 | 160 | 34 | 30 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_date_timezone_x_and_y | test_date_timezone_x_and_y | 5,965 | 5,979 | 5,965 | 5,967 | 36556dd969591a5539a8660cdf83b918ce0a100d | bigcode/the-stack | train |
35fa9dccce02f807f739022f | train | function | def test_bar_label_location_errorbars():
ax = plt.gca()
xs, heights = [1, 2], [3, -4]
rects = ax.bar(xs, heights, yerr=1)
labels = ax.bar_label(rects)
assert labels[0].xy == (xs[0], heights[0] + 1)
assert labels[0].get_ha() == 'center'
assert labels[0].get_va() == 'bottom'
assert... | def test_bar_label_location_errorbars():
| ax = plt.gca()
xs, heights = [1, 2], [3, -4]
rects = ax.bar(xs, heights, yerr=1)
labels = ax.bar_label(rects)
assert labels[0].xy == (xs[0], heights[0] + 1)
assert labels[0].get_ha() == 'center'
assert labels[0].get_va() == 'bottom'
assert labels[1].xy == (xs[1], heights[1] - 1)
... | _va() == 'center'
assert labels[1].xy == (widths[1] / 2, ys[1])
assert labels[1].get_ha() == 'center'
assert labels[1].get_va() == 'center'
def test_bar_label_location_errorbars():
| 63 | 64 | 152 | 8 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_label_location_errorbars | test_bar_label_location_errorbars | 7,108 | 7,118 | 7,108 | 7,108 | 75d51862f9a95df83530400313f61b6a99c7f542 | bigcode/the-stack | train |
23165f8e72d473c59f11c438 | train | function | def test_parse_scatter_color_args_error():
def get_next_color():
return 'blue' # currently unused
with pytest.raises(ValueError,
match="RGBA values should be within 0-1 range"):
c = np.array([[0.1, 0.2, 0.7], [0.2, 0.4, 1.4]]) # value > 1
mpl.axes.Axes._p... | def test_parse_scatter_color_args_error():
| def get_next_color():
return 'blue' # currently unused
with pytest.raises(ValueError,
match="RGBA values should be within 0-1 range"):
c = np.array([[0.1, 0.2, 0.7], [0.2, 0.4, 1.4]]) # value > 1
mpl.axes.Axes._parse_scatter_color_args(
c, Non... | colors', None)
_, _, result_edgecolors = \
mpl.axes.Axes._parse_scatter_color_args(
c, edgecolors, kwargs, xsize=2, get_next_color_func=get_next_color)
assert result_edgecolors == expected_edgecolors
def test_parse_scatter_color_args_error():
| 64 | 64 | 120 | 9 | 54 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_parse_scatter_color_args_error | test_parse_scatter_color_args_error | 2,442 | 2,450 | 2,442 | 2,442 | ddb95e7aa02c34158d1a4cb98ee6920fe2b43504 | bigcode/the-stack | train |
7d894066a27e60c2fea03fc5 | train | function | def test_mollweide_inverse_forward_closure():
# test that the round-trip Mollweide inverse->forward transformation is an
# approximate identity
fig = plt.figure()
ax = fig.add_subplot(projection='mollweide')
# set up grid in x, y
x = np.linspace(0, 1, 500)
x, y = np.meshgrid(x, x)
... | def test_mollweide_inverse_forward_closure():
# test that the round-trip Mollweide inverse->forward transformation is an
# approximate identity
| fig = plt.figure()
ax = fig.add_subplot(projection='mollweide')
# set up grid in x, y
x = np.linspace(0, 1, 500)
x, y = np.meshgrid(x, x)
xy = np.vstack((x.flatten(), y.flatten())).T
# perform inverse transform
ll = ax.transProjection.inverted().transform(xy)
# perform ... | = ax.transProjection.inverted().transform(xy)
# compare
np.testing.assert_array_almost_equal(ll, ll2, 3)
def test_mollweide_inverse_forward_closure():
# test that the round-trip Mollweide inverse->forward transformation is an
# approximate identity
| 64 | 64 | 159 | 33 | 31 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_mollweide_inverse_forward_closure | test_mollweide_inverse_forward_closure | 3,936 | 3,954 | 3,936 | 3,938 | 93fb7576a9a3a5025e60bc2917b710fd5aa0a331 | bigcode/the-stack | train |
87e77c67717cbb7a9b8bc574 | train | function | def test_errobar_nonefmt():
# Check that passing 'none' as a format still plots errorbars
x = np.arange(5)
y = np.arange(5)
plotline, _, barlines = plt.errorbar(x, y, xerr=1, yerr=1, fmt='none')
assert plotline is None
for errbar in barlines:
assert np.all(errbar.get_color() == ... | def test_errobar_nonefmt():
# Check that passing 'none' as a format still plots errorbars
| x = np.arange(5)
y = np.arange(5)
plotline, _, barlines = plt.errorbar(x, y, xerr=1, yerr=1, fmt='none')
assert plotline is None
for errbar in barlines:
assert np.all(errbar.get_color() == mcolors.to_rgba('C0'))
| ', mec='blue', capsize=0,
color='cyan')
ax.set_xlim((0, 5.5))
ax.set_title('Errorbar upper and lower limits')
def test_errobar_nonefmt():
# Check that passing 'none' as a format still plots errorbars
| 63 | 64 | 103 | 24 | 39 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_errobar_nonefmt | test_errobar_nonefmt | 3,451 | 3,459 | 3,451 | 3,452 | db128fab1b882dc59c4a037fded40f7e37f5407b | bigcode/the-stack | train |
8e2a76cf1b182b6c95cfa617 | train | function | @check_figures_equal(extensions=["png"])
def test_specgram_origin_rcparam(fig_test, fig_ref):
"""Test specgram ignores image.origin rcParam and uses origin 'upper'."""
t = np.arange(500)
signal = np.sin(t)
plt.rcParams["image.origin"] = 'upper'
# Reference: First graph using default origin... | @check_figures_equal(extensions=["png"])
def test_specgram_origin_rcparam(fig_test, fig_ref):
| """Test specgram ignores image.origin rcParam and uses origin 'upper'."""
t = np.arange(500)
signal = np.sin(t)
plt.rcParams["image.origin"] = 'upper'
# Reference: First graph using default origin in imshow (upper),
fig_ref.subplots().specgram(signal)
# Try to overwrite the setti... | gram(np.ones(300), Fs=None, scale='linear')
xmin, xmax, freq0, freq1 = im.get_extent()
assert xmin == 32 and xmax == 96
@check_figures_equal(extensions=["png"])
def test_specgram_origin_rcparam(fig_test, fig_ref):
| 64 | 64 | 140 | 24 | 39 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_specgram_origin_rcparam | test_specgram_origin_rcparam | 4,580 | 4,595 | 4,580 | 4,581 | 4345d6d46cbacc16447a0e9645591a22fb8ffeb3 | bigcode/the-stack | train |
db46cad50c741a26e5549f3b | train | function | @mpl.style.context('default')
def test_autoscale_tight():
fig, ax = plt.subplots(1, 1)
ax.plot([1, 2, 3, 4])
ax.autoscale(enable=True, axis='x', tight=False)
ax.autoscale(enable=True, axis='y', tight=True)
assert_allclose(ax.get_xlim(), (-0.15, 3.15))
assert_allclose(ax.get_ylim(), (1.0, ... | @mpl.style.context('default')
def test_autoscale_tight():
| fig, ax = plt.subplots(1, 1)
ax.plot([1, 2, 3, 4])
ax.autoscale(enable=True, axis='x', tight=False)
ax.autoscale(enable=True, axis='y', tight=True)
assert_allclose(ax.get_xlim(), (-0.15, 3.15))
assert_allclose(ax.get_ylim(), (1.0, 4.0))
| .subplots(2, 2)
for i, ax in enumerate(axs.flat):
y1 = 10**(-11 - i)
ax.plot([0, 1], [1, 1 + y1])
@mpl.style.context('default')
def test_autoscale_tight():
| 63 | 64 | 109 | 15 | 48 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_autoscale_tight | test_autoscale_tight | 460 | 467 | 460 | 461 | cb2293ab42df67679ae6197ebe1f77ffeeb6c2d8 | bigcode/the-stack | train |
105871540fcd1ea987713eb3 | train | function | @check_figures_equal(extensions=["pdf"])
def test_2dcolor_plot(fig_test, fig_ref):
color = np.array([0.1, 0.2, 0.3])
# plot with 1D-color:
axs = fig_test.subplots(5)
axs[0].plot([1, 2], [1, 2], c=color.reshape(-1))
axs[1].scatter([1, 2], [1, 2], c=color.reshape(-1))
axs[2].step([1, 2], [1... | @check_figures_equal(extensions=["pdf"])
def test_2dcolor_plot(fig_test, fig_ref):
| color = np.array([0.1, 0.2, 0.3])
# plot with 1D-color:
axs = fig_test.subplots(5)
axs[0].plot([1, 2], [1, 2], c=color.reshape(-1))
axs[1].scatter([1, 2], [1, 2], c=color.reshape(-1))
axs[2].step([1, 2], [1, 2], c=color.reshape(-1))
axs[3].hist(np.arange(10), color=color.reshape(-1))
... | ax0 = fig.add_subplot(221)
ax1 = fig.add_axes([.6, .6, .3, .3], sharex=ax0)
init_pos = ax1.get_position()
fig.subplots_adjust(left=0)
assert (ax1.get_position().get_points() == init_pos.get_points()).all()
@check_figures_equal(extensions=["pdf"])
def test_2dcolor_plot(fig_test, fig_ref):
| 95 | 95 | 317 | 24 | 71 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_2dcolor_plot | test_2dcolor_plot | 7,011 | 7,027 | 7,011 | 7,012 | a65df439e5dcc108d40a86d4ae3387aa18ceecea | bigcode/the-stack | train |
a21bc3dd245ef772b39e2bb2 | train | function | def test_boxplot_zorder():
x = np.arange(10)
fix, ax = plt.subplots()
assert ax.boxplot(x)['boxes'][0].get_zorder() == 2
assert ax.boxplot(x, zorder=10)['boxes'][0].get_zorder() == 10
| def test_boxplot_zorder():
| x = np.arange(10)
fix, ax = plt.subplots()
assert ax.boxplot(x)['boxes'][0].get_zorder() == 2
assert ax.boxplot(x, zorder=10)['boxes'][0].get_zorder() == 10
| .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_zorder():
| 63 | 64 | 66 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_zorder | test_boxplot_zorder | 3,019 | 3,023 | 3,019 | 3,019 | 49ae969a7389369d3286d917a1f221de385c8405 | bigcode/the-stack | train |
2fe8553cfd8d84ca0278f60f | train | function | @image_comparison(['bar_tick_label_multiple.png'])
def test_bar_tick_label_multiple():
# From 2516: plot bar with array of string labels for x axis
ax = plt.gca()
ax.bar([1, 2.5], [1, 2], width=[0.2, 0.5], tick_label=['a', 'b'],
align='center')
| @image_comparison(['bar_tick_label_multiple.png'])
def test_bar_tick_label_multiple():
# From 2516: plot bar with array of string labels for x axis
| ax = plt.gca()
ax.bar([1, 2.5], [1, 2], width=[0.2, 0.5], tick_label=['a', 'b'],
align='center')
| np.nan, 4])
def test_bar_ticklabel_fail():
fig, ax = plt.subplots()
ax.bar([], [])
@image_comparison(['bar_tick_label_multiple.png'])
def test_bar_tick_label_multiple():
# From 2516: plot bar with array of string labels for x axis
| 63 | 64 | 84 | 36 | 27 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_tick_label_multiple | test_bar_tick_label_multiple | 1,523 | 1,528 | 1,523 | 1,525 | 4c29c3aa5eb6018879e38bb0394ca93f3ff9fff0 | bigcode/the-stack | train |
c00d05385ca6013e322883d2 | train | function | @image_comparison(['imshow', 'imshow'], remove_text=True, style='mpl20')
def test_imshow():
# use former defaults to match existing baseline image
matplotlib.rcParams['image.interpolation'] = 'nearest'
# Create a NxN image
N = 100
(x, y) = np.indices((N, N))
x -= N//2
y -= N//2
... | @image_comparison(['imshow', 'imshow'], remove_text=True, style='mpl20')
def test_imshow():
# use former defaults to match existing baseline image
| matplotlib.rcParams['image.interpolation'] = 'nearest'
# Create a NxN image
N = 100
(x, y) = np.indices((N, N))
x -= N//2
y -= N//2
r = np.sqrt(x**2+y**2-x*y)
# Create a contour plot at N/4 and extract both the clip path and transform
fig, ax = plt.subplots()
ax.imshow... | for ax in [ax_test, ax_ref]:
getattr(ax, plot_fun)(x, range(len(x)), color='C0')
@image_comparison(['imshow', 'imshow'], remove_text=True, style='mpl20')
def test_imshow():
# use former defaults to match existing baseline image
| 63 | 64 | 174 | 35 | 28 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_imshow | test_imshow | 850 | 868 | 850 | 852 | 9f706be162147fccca9e58160bb5817c483f7c80 | bigcode/the-stack | train |
3d2731840e3b291464964724 | train | function | def test_psd_csd_edge_cases():
# Inverted yaxis or fully zero inputs used to throw exceptions.
axs = plt.figure().subplots(2)
for ax in axs:
ax.yaxis.set(inverted=True)
with np.errstate(divide="ignore"):
axs[0].psd(np.zeros(5))
axs[1].csd(np.zeros(5), np.zeros(5))
| def test_psd_csd_edge_cases():
# Inverted yaxis or fully zero inputs used to throw exceptions.
| axs = plt.figure().subplots(2)
for ax in axs:
ax.yaxis.set(inverted=True)
with np.errstate(divide="ignore"):
axs[0].psd(np.zeros(5))
axs[1].csd(np.zeros(5), np.zeros(5))
| subplots(3), all_sides):
spec, freqs, line = ax.phase_spectrum(y, sides=sides, **kwargs)
ax.set(xlabel="", ylabel="")
def test_psd_csd_edge_cases():
# Inverted yaxis or fully zero inputs used to throw exceptions.
| 62 | 64 | 89 | 24 | 39 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_psd_csd_edge_cases | test_psd_csd_edge_cases | 4,683 | 4,690 | 4,683 | 4,684 | be403315e4d4383b9685ad250cb1c47687ad6ec8 | bigcode/the-stack | train |
7b78ddae363675fbfe98506b | train | function | @pytest.mark.parametrize("bins_preprocess",
[mpl.dates.date2num,
lambda bins: bins,
lambda bins: np.asarray(bins).astype('datetime64')],
ids=['date2num', 'datetime.datetime',
'np.date... | @pytest.mark.parametrize("bins_preprocess",
[mpl.dates.date2num,
lambda bins: bins,
lambda bins: np.asarray(bins).astype('datetime64')],
ids=['date2num', 'datetime.datetime',
'np.date... | data = [[datetime.datetime(2019, 1, 5), datetime.datetime(2019, 1, 11),
datetime.datetime(2019, 2, 1), datetime.datetime(2019, 3, 1)],
[datetime.datetime(2019, 1, 11), datetime.datetime(2019, 2, 5),
datetime.datetime(2019, 2, 18), datetime.datetime(2019, 3, 1)]]
date_... | fig, ax = plt.subplots()
ax.hist(data, stacked=True)
ax.hist(data, stacked=False)
@pytest.mark.parametrize("bins_preprocess",
[mpl.dates.date2num,
lambda bins: bins,
lambda bins: np.asarray(bins).astype('datetime64')],
... | 90 | 90 | 303 | 67 | 23 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_datetime_datasets_bins | test_hist_datetime_datasets_bins | 1,830 | 1,850 | 1,830 | 1,836 | 75a19f63324f0538750b81014cb370a688f550fa | bigcode/the-stack | train |
2433e38ccae99c370f5585c2 | train | function | @image_comparison(['bxp_customcap.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customcap():
_bxp_test_helper(bxp_kwargs=dict(
capprops=dict(linestyle='--', color='g', lw=3)))
| @image_comparison(['bxp_customcap.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customcap():
| _bxp_test_helper(bxp_kwargs=dict(
capprops=dict(linestyle='--', color='g', lw=3)))
| _helper(bxp_kwargs=dict(
medianprops=dict(linestyle='--', color='b', lw=3)))
@image_comparison(['bxp_customcap.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customcap():
| 63 | 64 | 68 | 39 | 24 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_customcap | test_bxp_customcap | 2,723 | 2,729 | 2,723 | 2,727 | bf7328dcb9536d157d10bce0bdeae4a0991d64ce | bigcode/the-stack | train |
e44ea9ff2658c133f6280f79 | train | function | @check_figures_equal(extensions=["png"])
def test_set_ticks_with_labels(fig_test, fig_ref):
"""
Test that these two are identical::
set_xticks(ticks); set_xticklabels(labels, **kwargs)
set_xticks(ticks, labels, **kwargs)
"""
ax = fig_ref.subplots()
ax.set_xticks([1, 2, 4,... | @check_figures_equal(extensions=["png"])
def test_set_ticks_with_labels(fig_test, fig_ref):
| """
Test that these two are identical::
set_xticks(ticks); set_xticklabels(labels, **kwargs)
set_xticks(ticks, labels, **kwargs)
"""
ax = fig_ref.subplots()
ax.set_xticks([1, 2, 4, 6])
ax.set_xticklabels(['a', 'b', 'c', 'd'], fontweight='bold')
ax.set_yticks([1, 3... | yticks(ax[0].get_yticks())
ax[1].set_xticklabels(ax[0].get_xticklabels())
ax[1].set_yticklabels(ax[0].get_yticklabels())
@check_figures_equal(extensions=["png"])
def test_set_ticks_with_labels(fig_test, fig_ref):
| 68 | 69 | 231 | 23 | 45 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_set_ticks_with_labels | test_set_ticks_with_labels | 5,189 | 5,208 | 5,189 | 5,190 | a33b35a3dd2d5ef038ca0e56eb439dcb86d0301e | bigcode/the-stack | train |
f00f52719e9a6096e31de86b | train | function | @image_comparison(['bxp_custompatchartist.png'],
remove_text=True,
savefig_kwarg={'dpi': 100},
style='default')
def test_bxp_custompatchartist():
_bxp_test_helper(bxp_kwargs=dict(
patch_artist=True,
boxprops=dict(facecolor='yellow', edgeco... | @image_comparison(['bxp_custompatchartist.png'],
remove_text=True,
savefig_kwarg={'dpi': 100},
style='default')
def test_bxp_custompatchartist():
| _bxp_test_helper(bxp_kwargs=dict(
patch_artist=True,
boxprops=dict(facecolor='yellow', edgecolor='green', ls=':')))
| def test_bxp_patchartist():
_bxp_test_helper(bxp_kwargs=dict(patch_artist=True))
@image_comparison(['bxp_custompatchartist.png'],
remove_text=True,
savefig_kwarg={'dpi': 100},
style='default')
def test_bxp_custompatchartist():
| 63 | 64 | 76 | 41 | 22 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_custompatchartist | test_bxp_custompatchartist | 2,675 | 2,682 | 2,675 | 2,679 | affa9338cdef324c660d428bf426ff558e0fc14f | bigcode/the-stack | train |
49dedac596cc8bd96b914401 | train | function | def test_bar_timedelta():
"""Smoketest that bar can handle width and height in delta units."""
fig, ax = plt.subplots()
ax.bar(datetime.datetime(2018, 1, 1), 1.,
width=datetime.timedelta(hours=3))
ax.bar(datetime.datetime(2018, 1, 1), 1.,
xerr=datetime.timedelta(hours=2),
... | def test_bar_timedelta():
| """Smoketest that bar can handle width and height in delta units."""
fig, ax = plt.subplots()
ax.bar(datetime.datetime(2018, 1, 1), 1.,
width=datetime.timedelta(hours=3))
ax.bar(datetime.datetime(2018, 1, 1), 1.,
xerr=datetime.timedelta(hours=2),
width=datetime.tim... | 0)
@image_comparison(['barh_tick_label.png'])
def test_barh_tick_label():
# From 2516: plot barh with array of string labels for y axis
ax = plt.gca()
ax.barh([1, 2.5], [1, 2], height=[0.2, 0.5], tick_label=['a', 'b'],
align='center')
def test_bar_timedelta():
| 94 | 95 | 317 | 6 | 88 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_timedelta | test_bar_timedelta | 1,620 | 1,643 | 1,620 | 1,620 | b691724a24683076a38ea247ec6c45b0ccebc9ac | bigcode/the-stack | train |
55111271cab3e9ca06d70f03 | train | function | def test_log_margins():
plt.rcParams['axes.autolimit_mode'] = 'data'
fig, ax = plt.subplots()
margin = 0.05
ax.set_xmargin(margin)
ax.semilogx([10, 100], [10, 100])
xlim0, xlim1 = ax.get_xlim()
transform = ax.xaxis.get_transform()
xlim0t, xlim1t = transform.transform([xlim0, xlim... | def test_log_margins():
| plt.rcParams['axes.autolimit_mode'] = 'data'
fig, ax = plt.subplots()
margin = 0.05
ax.set_xmargin(margin)
ax.semilogx([10, 100], [10, 100])
xlim0, xlim1 = ax.get_xlim()
transform = ax.xaxis.get_transform()
xlim0t, xlim1t = transform.transform([xlim0, xlim1])
x0t, x1t = trans... | 3), **{el: 'k'})
face_target = mcolors.to_rgba('C{}'.format(j))
assert tuple(cc.get_facecolors().squeeze()) == tuple(face_target)
assert tuple(cc.get_edgecolors().squeeze()) == tuple(edge_target)
def test_log_margins():
| 64 | 64 | 168 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_log_margins | test_log_margins | 6,161 | 6,172 | 6,161 | 6,161 | 3049435e9274cdbe3dd17964fbf06bde5f634e5a | bigcode/the-stack | train |
011ee41d9f938a536ec14350 | train | function | @image_comparison(['stackplot_test_baseline'], remove_text=True)
def test_stackplot_baseline():
np.random.seed(0)
def layers(n, m):
a = np.zeros((m, n))
for i in range(n):
for j in range(5):
x = 1 / (.1 + np.random.random())
y = 2 * np.random... | @image_comparison(['stackplot_test_baseline'], remove_text=True)
def test_stackplot_baseline():
| np.random.seed(0)
def layers(n, m):
a = np.zeros((m, n))
for i in range(n):
for j in range(5):
x = 1 / (.1 + np.random.random())
y = 2 * np.random.random() - .5
z = 10 / (.1 + np.random.random())
a[:, i] += x *... | "y3": y3}
fig, ax = plt.subplots()
ax.stackplot("x", "y1", "y2", "y3", data=data)
ax.set_xlim((0, 10))
ax.set_ylim((0, 70))
@image_comparison(['stackplot_test_baseline'], remove_text=True)
def test_stackplot_baseline():
| 79 | 80 | 267 | 22 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stackplot_baseline | test_stackplot_baseline | 2,569 | 2,591 | 2,569 | 2,570 | f2fd46df2d6420f36eb70303b4a44948322733fc | bigcode/the-stack | train |
4c0a2a81c087ba74656844c4 | train | function | @check_figures_equal(extensions=['png'])
def test_eventplot_units_list(fig_test, fig_ref):
# test that list of lists converted properly:
ts_1 = [datetime.datetime(2021, 1, 1), datetime.datetime(2021, 1, 2),
datetime.datetime(2021, 1, 3)]
ts_2 = [datetime.datetime(2021, 1, 15), datetime.date... | @check_figures_equal(extensions=['png'])
def test_eventplot_units_list(fig_test, fig_ref):
# test that list of lists converted properly:
| ts_1 = [datetime.datetime(2021, 1, 1), datetime.datetime(2021, 1, 2),
datetime.datetime(2021, 1, 3)]
ts_2 = [datetime.datetime(2021, 1, 15), datetime.datetime(2021, 1, 16)]
ax = fig_ref.subplots()
ax.eventplot(ts_1, lineoffsets=0)
ax.eventplot(ts_2, lineoffsets=1)
ax = fig_... | else {'orientation': orientation}
fig, ax = plt.subplots(1, 1)
ax.eventplot(data, **opts)
plt.draw()
@check_figures_equal(extensions=['png'])
def test_eventplot_units_list(fig_test, fig_ref):
# test that list of lists converted properly:
| 64 | 64 | 161 | 32 | 32 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_eventplot_units_list | test_eventplot_units_list | 4,119 | 4,131 | 4,119 | 4,121 | 32e27c38a8e5b92a5725376327564b67ea0d88b8 | bigcode/the-stack | train |
b9fd1406247d575a602ef6bb | train | function | @mpl.style.context('default')
def test_use_sticky_edges():
fig, ax = plt.subplots()
ax.imshow([[0, 1], [2, 3]], origin='lower')
assert_allclose(ax.get_xlim(), (-0.5, 1.5))
assert_allclose(ax.get_ylim(), (-0.5, 1.5))
ax.use_sticky_edges = False
ax.autoscale()
xlim = (-0.5 - 2 * ax._xm... | @mpl.style.context('default')
def test_use_sticky_edges():
| fig, ax = plt.subplots()
ax.imshow([[0, 1], [2, 3]], origin='lower')
assert_allclose(ax.get_xlim(), (-0.5, 1.5))
assert_allclose(ax.get_ylim(), (-0.5, 1.5))
ax.use_sticky_edges = False
ax.autoscale()
xlim = (-0.5 - 2 * ax._xmargin, 1.5 + 2 * ax._xmargin)
ylim = (-0.5 - 2 * ax._yma... | assert_allclose(ax1.get_xlim(), lims)
assert_allclose(ax1.get_ylim(), lims)
assert_allclose(ax2.get_xlim(), lims)
assert_allclose(ax2.get_ylim(), (x[0], x[-1]))
@mpl.style.context('default')
def test_use_sticky_edges():
| 68 | 69 | 231 | 14 | 54 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_use_sticky_edges | test_use_sticky_edges | 488 | 504 | 488 | 489 | df7b2ff5cca44e59b5d98221bb79a5951f713fc2 | bigcode/the-stack | train |
651a053f34a28fe557db91e8 | train | function | def test_hist_barstacked_bottom_unchanged():
b = np.array([10, 20])
plt.hist([[0, 1], [0, 1]], 2, histtype="barstacked", bottom=b)
assert b.tolist() == [10, 20]
| def test_hist_barstacked_bottom_unchanged():
| b = np.array([10, 20])
plt.hist([[0, 1], [0, 1]], 2, histtype="barstacked", bottom=b)
assert b.tolist() == [10, 20]
| .hist(d, bins=10, histtype='barstacked', align='mid', color=colors,
label=labels)
ax.legend(loc='upper right', bbox_to_anchor=(1.0, 1.0), ncol=1)
def test_hist_barstacked_bottom_unchanged():
| 64 | 64 | 62 | 11 | 53 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_barstacked_bottom_unchanged | test_hist_barstacked_bottom_unchanged | 3,853 | 3,856 | 3,853 | 3,853 | cafc34034157ef133c1db656ac515d595ad18c75 | bigcode/the-stack | train |
1b329319ad0241c182980adb | train | function | def test_strmethodformatter_auto_formatter():
formstr = '{x}_{pos}'
ax = plt.figure().subplots()
assert ax.xaxis.isDefault_majfmt
assert ax.xaxis.isDefault_minfmt
assert ax.yaxis.isDefault_majfmt
assert ax.yaxis.isDefault_minfmt
ax.yaxis.set_minor_formatter(formstr)
asser... | def test_strmethodformatter_auto_formatter():
| formstr = '{x}_{pos}'
ax = plt.figure().subplots()
assert ax.xaxis.isDefault_majfmt
assert ax.xaxis.isDefault_minfmt
assert ax.yaxis.isDefault_majfmt
assert ax.yaxis.isDefault_minfmt
ax.yaxis.set_minor_formatter(formstr)
assert ax.xaxis.isDefault_majfmt
assert ax.xaxi... |
assert ax.yaxis.isDefault_minfmt
targ_funcformatter = mticker.FuncFormatter(_formfunc)
assert isinstance(ax.xaxis.get_major_formatter(),
mticker.FuncFormatter)
assert ax.xaxis.get_major_formatter().func == targ_funcformatter.func
def test_strmethodformatter_auto_formatt... | 64 | 64 | 169 | 8 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_strmethodformatter_auto_formatter | test_strmethodformatter_auto_formatter | 238 | 260 | 238 | 238 | 9c1b93f43f23167da90486b16a2418c168e9f03c | bigcode/the-stack | train |
baac1828a1d17584143e677c | train | function | def test_xtickcolor_is_not_markercolor():
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_xtickcolor_is_not_markercolor():
| plt.rcParams['lines.markeredgecolor'] = 'white'
ax = plt.axes()
ticks = ax.xaxis.get_major_ticks()
for tick in ticks:
assert tick.tick1line.get_markeredgecolor() != 'white'
| # invisible axes should not respond to events...
fig, ax = plt.subplots()
assert fig.canvas.inaxes((200, 200)) is not None
ax.set_visible(False)
assert fig.canvas.inaxes((200, 200)) is None
def test_xtickcolor_is_not_markercolor():
| 64 | 64 | 61 | 10 | 53 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_xtickcolor_is_not_markercolor | test_xtickcolor_is_not_markercolor | 6,907 | 6,912 | 6,907 | 6,907 | 2d63a476aee9b871a7d6afc3277653456c24203e | bigcode/the-stack | train |
ecd3abaaca837a68b1d604c6 | train | function | def test_tickdirs():
"""
Switch the tickdirs and make sure the bboxes switch with them
"""
targets = [[[150.0, 120.0, 930.0, 11.1111],
[150.0, 120.0, 11.111, 960.0]],
[[150.0, 108.8889, 930.0, 11.111111111111114],
[138.889, 120, 11.111, 960.0]],
... | def test_tickdirs():
| """
Switch the tickdirs and make sure the bboxes switch with them
"""
targets = [[[150.0, 120.0, 930.0, 11.1111],
[150.0, 120.0, 11.111, 960.0]],
[[150.0, 108.8889, 930.0, 11.111111111111114],
[138.889, 120, 11.111, 960.0]],
[[150.0, 1... | 960.0]
targetbb = mtransforms.Bbox.from_bounds(*target)
assert_allclose(bbax.bounds, targetbb.bounds, atol=1e-2)
target = [150., 24., 930., 1056.]
targetbb = mtransforms.Bbox.from_bounds(*target)
assert_allclose(bbtb.bounds, targetbb.bounds, atol=1e-2)
def test_tickdirs():
| 93 | 93 | 313 | 5 | 88 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_tickdirs | test_tickdirs | 6,657 | 6,676 | 6,657 | 6,657 | 254b09a3d49555ceeb58da72c9f56aab6ee2497c | bigcode/the-stack | train |
dcb47967f943443372fc33fa | train | function | def test_square_plot():
x = np.arange(4)
y = np.array([1., 3., 5., 7.])
fig, ax = plt.subplots()
ax.plot(x, y, 'mo')
ax.axis('square')
xlim, ylim = ax.get_xlim(), ax.get_ylim()
assert np.diff(xlim) == np.diff(ylim)
assert ax.get_aspect() == 1
assert_array_almost_equal(
... | def test_square_plot():
| x = np.arange(4)
y = np.array([1., 3., 5., 7.])
fig, ax = plt.subplots()
ax.plot(x, y, 'mo')
ax.axis('square')
xlim, ylim = ax.get_xlim(), ax.get_ylim()
assert np.diff(xlim) == np.diff(ylim)
assert ax.get_aspect() == 1
assert_array_almost_equal(
ax.get_position(origi... | _tick_kw['tick2On']
assert not yax._major_tick_kw['tick1On']
assert yax._major_tick_kw['tick2On']
assert not yax._minor_tick_kw['tick1On']
assert yax._minor_tick_kw['tick2On']
def test_square_plot():
| 63 | 64 | 169 | 5 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_square_plot | test_square_plot | 5,470 | 5,482 | 5,470 | 5,470 | 277f91d78b523e489baa56a51ae21255d32609de | bigcode/the-stack | train |
27a7891b9c527e1a83a605aa | train | function | def test_get_labels():
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'
| def test_get_labels():
| 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'
| Warning
# Note: Some test cases are run twice: once normally and once with labeled data
# These two must be defined in the same test function or need to have
# different baseline images to prevent race conditions when pytest runs
# the tests with multiple threads.
def test_get_labels():
| 63 | 64 | 51 | 5 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_get_labels | test_get_labels | 40 | 45 | 40 | 40 | 6ce2e0c3fba7581cc4fd2a145c53e25c0bd34f28 | bigcode/the-stack | train |
fcfad27fe2d1ec1f9bb265b9 | train | function | def test_structured_data():
# support for structured data
pts = np.array([(1, 1), (2, 2)], dtype=[("ones", float), ("twos", float)])
# this should not read second name as a format and raise ValueError
axs = plt.figure().subplots(2)
axs[0].plot("ones", "twos", data=pts)
axs[1].plot("ones"... | def test_structured_data():
# support for structured data
| pts = np.array([(1, 1), (2, 2)], dtype=[("ones", float), ("twos", float)])
# this should not read second name as a format and raise ValueError
axs = plt.figure().subplots(2)
axs[0].plot("ones", "twos", data=pts)
axs[1].plot("ones", "twos", "r", data=pts)
| # xlim from the implicit "x=0", ylim from the row datalim.
axs[0].set(xlim=(-.06, .06), ylim=(0, 9))
axs[1].plot(col.ravel())
def test_structured_data():
# support for structured data
| 63 | 64 | 108 | 13 | 50 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_structured_data | test_structured_data | 680 | 687 | 680 | 681 | f39525ca7d8dd0486c0f37c8ebbee68b33274c88 | bigcode/the-stack | train |
8ee8f6afe3fee1827aecddfd | train | function | def test_violinplot_bad_widths():
ax = plt.axes()
# First 9 digits of frac(sqrt(53))
np.random.seed(280109889)
data = [np.random.normal(size=100) for _ in range(4)]
with pytest.raises(ValueError):
ax.violinplot(data, positions=range(4), widths=[1, 2, 3])
| def test_violinplot_bad_widths():
| ax = plt.axes()
# First 9 digits of frac(sqrt(53))
np.random.seed(280109889)
data = [np.random.normal(size=100) for _ in range(4)]
with pytest.raises(ValueError):
ax.violinplot(data, positions=range(4), widths=[1, 2, 3])
| of frac(sqrt(47))
np.random.seed(855654600)
data = [np.random.normal(size=100) for _ in range(4)]
with pytest.raises(ValueError):
ax.violinplot(data, positions=range(5))
def test_violinplot_bad_widths():
| 63 | 64 | 85 | 9 | 54 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_violinplot_bad_widths | test_violinplot_bad_widths | 3,213 | 3,219 | 3,213 | 3,213 | e888c4c572610f7ab472ed225a3359b814ed0d58 | bigcode/the-stack | train |
b3874292b3110b0edf9f553b | train | function | def test_hexbin_pickable():
# From #1973: Test that picking a hexbin collection works
fig, ax = plt.subplots()
data = (np.arange(200) / 200).reshape((2, 100))
x, y = data
hb = ax.hexbin(x, y, extent=[.1, .3, .6, .7], picker=-1)
mouse_event = SimpleNamespace(x=400, y=300)
assert hb.con... | def test_hexbin_pickable():
# From #1973: Test that picking a hexbin collection works
| fig, ax = plt.subplots()
data = (np.arange(200) / 200).reshape((2, 100))
x, y = data
hb = ax.hexbin(x, y, extent=[.1, .3, .6, .7], picker=-1)
mouse_event = SimpleNamespace(x=400, y=300)
assert hb.contains(mouse_event)[0]
| remove_text=True)
def test_hexbin_empty():
# From #3886: creating hexbin from empty dataset raises ValueError
ax = plt.gca()
ax.hexbin([], [])
def test_hexbin_pickable():
# From #1973: Test that picking a hexbin collection works
| 63 | 64 | 109 | 23 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hexbin_pickable | test_hexbin_pickable | 760 | 767 | 760 | 761 | b9eef19c47e5063c56b92c0cd287b14ffc808b8b | bigcode/the-stack | train |
d81e041e5e5d2ce98bf389f3 | train | function | def test_arrow_empty():
_, ax = plt.subplots()
# Create an empty FancyArrow
ax.arrow(0, 0, 0, 0, head_length=0)
| def test_arrow_empty():
| _, ax = plt.subplots()
# Create an empty FancyArrow
ax.arrow(0, 0, 0, 0, head_length=0)
| (theta), np.cos(theta),
width=theta/100,
length_includes_head=length_includes_head,
shape=shape,
head_starts_at_zero=head_starts_at_zero,
head_width=theta / 10,
head_length=theta / 10)
def test_arrow_empty():
| 64 | 64 | 40 | 5 | 59 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_arrow_empty | test_arrow_empty | 565 | 568 | 565 | 565 | 0cedd4d1cc80bf31b8d68c3f5eaf2b14e16dff47 | bigcode/the-stack | train |
c7d3031ceeef94dfed8c58d9 | train | function | def test_bar_label_location_horizontal():
ax = plt.gca()
ys, widths = [1, 2], [3, -4]
rects = ax.barh(ys, widths)
labels = ax.bar_label(rects)
assert labels[0].xy == (widths[0], ys[0])
assert labels[0].get_ha() == 'left'
assert labels[0].get_va() == 'center'
assert labels[1].xy =... | def test_bar_label_location_horizontal():
| ax = plt.gca()
ys, widths = [1, 2], [3, -4]
rects = ax.barh(ys, widths)
labels = ax.bar_label(rects)
assert labels[0].xy == (widths[0], ys[0])
assert labels[0].get_ha() == 'left'
assert labels[0].get_va() == 'center'
assert labels[1].xy == (widths[1], ys[1])
assert labels[1].... | assert labels[0].get_va() == 'bottom'
assert labels[1].xy == (xs[1], heights[1])
assert labels[1].get_ha() == 'center'
assert labels[1].get_va() == 'top'
def test_bar_label_location_horizontal():
| 63 | 64 | 142 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_label_location_horizontal | test_bar_label_location_horizontal | 7,082 | 7,092 | 7,082 | 7,082 | 49b0ad9f8ec6a5d9b7651d0ff3d2913d28acf39b | bigcode/the-stack | train |
a90a14cf0a6dbd7b24effba3 | train | function | @pytest.mark.parametrize("use_line_collection", [True, False],
ids=['w/ line collection', 'w/o line collection'])
@image_comparison(['stem_orientation.png'], style='mpl20', remove_text=True)
def test_stem_orientation(use_line_collection):
x = np.linspace(0.1, 2*np.pi, 50)
fig, ax... | @pytest.mark.parametrize("use_line_collection", [True, False],
ids=['w/ line collection', 'w/o line collection'])
@image_comparison(['stem_orientation.png'], style='mpl20', remove_text=True)
def test_stem_orientation(use_line_collection):
| x = np.linspace(0.1, 2*np.pi, 50)
fig, ax = plt.subplots()
ax.stem(x, np.cos(x),
linefmt='C2-.', markerfmt='kx', basefmt='C1-.',
use_line_collection=use_line_collection, orientation='horizontal')
| 200]
ax.stem(xs, ys)
@pytest.mark.parametrize("use_line_collection", [True, False],
ids=['w/ line collection', 'w/o line collection'])
@image_comparison(['stem_orientation.png'], style='mpl20', remove_text=True)
def test_stem_orientation(use_line_collection):
| 64 | 64 | 123 | 54 | 10 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stem_orientation | test_stem_orientation | 3,658 | 3,667 | 3,658 | 3,661 | 8d4a7635302d5d320bfa22c02c31f03c6dc211e3 | bigcode/the-stack | train |
3cdea9270d7aea4d1a0658da | train | function | @image_comparison(['pie_no_label.png'])
def test_pie_nolabel_but_legend():
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, expl... | @image_comparison(['pie_no_label.png'])
def test_pie_nolabel_but_legend():
| 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%%', sh... | f%%', shadow=True, startangle=90,
rotatelabels=True)
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
@image_comparison(['pie_no_label.png'])
def test_pie_nolabel_but_legend():
| 63 | 64 | 183 | 22 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pie_nolabel_but_legend | test_pie_nolabel_but_legend | 5,111 | 5,122 | 5,111 | 5,112 | 1b2ad097d3cb8566d2f5826a134b47ac90b39485 | bigcode/the-stack | train |
8a804fcfb6395aa36c57b970 | train | function | def test_hist_step_bottom_geometry():
bins = [0, 1, 2, 3]
data = [0, 0, 1, 1, 1, 2]
_, _, (polygon, ) = plt.hist(data,
bins=bins,
bottom=[1, 2, 1.5],
histtype='step')
xy = [[0, 1], [0, 3], [1, 3], [... | def test_hist_step_bottom_geometry():
| bins = [0, 1, 2, 3]
data = [0, 0, 1, 1, 1, 2]
_, _, (polygon, ) = plt.hist(data,
bins=bins,
bottom=[1, 2, 1.5],
histtype='step')
xy = [[0, 1], [0, 3], [1, 3], [1, 5], [2, 5], [2, 2.5], [3, 2.5], [3, ... | 2.5],
[3, 1.5], [2, 1.5], [2, 2], [1, 2], [1, 1], [0, 1]]
assert_array_equal(polygon.get_xy(), xy)
def test_hist_step_bottom_geometry():
| 64 | 64 | 147 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_step_bottom_geometry | test_hist_step_bottom_geometry | 3,738 | 3,746 | 3,738 | 3,738 | 3009d95c31899bbecb66ff0b4078d29c1251a9d0 | bigcode/the-stack | train |
69046a269d754f7be9cbf5d9 | train | function | def test_mollweide_forward_inverse_closure():
# test that the round-trip Mollweide forward->inverse transformation is an
# approximate identity
fig = plt.figure()
ax = fig.add_subplot(projection='mollweide')
# set up 1-degree grid in longitude, latitude
lon = np.linspace(-np.pi, np.pi, 3... | def test_mollweide_forward_inverse_closure():
# test that the round-trip Mollweide forward->inverse transformation is an
# approximate identity
| fig = plt.figure()
ax = fig.add_subplot(projection='mollweide')
# set up 1-degree grid in longitude, latitude
lon = np.linspace(-np.pi, np.pi, 360)
lat = np.linspace(-np.pi / 2.0, np.pi / 2.0, 180)
lon, lat = np.meshgrid(lon, lat)
ll = np.vstack((lon.flatten(), lat.flatten())).T
... | weide
# projection
fig = plt.figure()
ax = fig.add_subplot(projection='mollweide')
ax.grid()
def test_mollweide_forward_inverse_closure():
# test that the round-trip Mollweide forward->inverse transformation is an
# approximate identity
| 64 | 64 | 188 | 33 | 31 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_mollweide_forward_inverse_closure | test_mollweide_forward_inverse_closure | 3,914 | 3,933 | 3,914 | 3,916 | b17c69a672c0d80890c69fa07a799f2895515439 | bigcode/the-stack | train |
9c070ebd80ec0fa36dff06f9 | train | function | @image_comparison(['single_point', 'single_point'])
def test_single_point():
# Issue #1796: don't let lines.marker affect the grid
matplotlib.rcParams['lines.marker'] = 'o'
matplotlib.rcParams['axes.grid'] = True
fig, (ax1, ax2) = plt.subplots(2)
ax1.plot([0], [0], 'o')
ax2.plot([1], [1... | @image_comparison(['single_point', 'single_point'])
def test_single_point():
# Issue #1796: don't let lines.marker affect the grid
| matplotlib.rcParams['lines.marker'] = 'o'
matplotlib.rcParams['axes.grid'] = True
fig, (ax1, ax2) = plt.subplots(2)
ax1.plot([0], [0], 'o')
ax2.plot([1], [1], 'o')
# Reuse testcase from above for a labeled data test
data = {'a': [0], 'b': [1]}
fig, (ax1, ax2) = plt.subplots(... | color='blue')
# smoke-test: should not warn
plt.errorbar([0], [0], fmt='none', color='blue')
@image_comparison(['single_point', 'single_point'])
def test_single_point():
# Issue #1796: don't let lines.marker affect the grid
| 63 | 64 | 174 | 32 | 31 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_single_point | test_single_point | 632 | 647 | 632 | 634 | 305fb988c007e5b65fb372b433c26dd2a15698eb | bigcode/the-stack | train |
c35cec04ec311a5742640b0c | train | function | def test_broken_barh_timedelta():
"""Check that timedelta works as x, dx pair for this method."""
fig, ax = plt.subplots()
d0 = datetime.datetime(2018, 11, 9, 0, 0, 0)
pp = ax.broken_barh([(d0, datetime.timedelta(hours=1))], [1, 2])
assert pp.get_paths()[0].vertices[0, 0] == mdates.date2num(d0)... | def test_broken_barh_timedelta():
| """Check that timedelta works as x, dx pair for this method."""
fig, ax = plt.subplots()
d0 = datetime.datetime(2018, 11, 9, 0, 0, 0)
pp = ax.broken_barh([(d0, datetime.timedelta(hours=1))], [1, 2])
assert pp.get_paths()[0].vertices[0, 0] == mdates.date2num(d0)
assert pp.get_paths()[0].vert... | ax.loglog([1e-20, 1e5], [1e-16, 10])
def test_broken_barh_empty():
fig, ax = plt.subplots()
ax.broken_barh([], (.1, .5))
def test_broken_barh_timedelta():
| 63 | 64 | 138 | 9 | 54 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_broken_barh_timedelta | test_broken_barh_timedelta | 5,781 | 5,787 | 5,781 | 5,781 | 0f464d7d5bfc229619a413ce20c98f87e790b9d9 | bigcode/the-stack | train |
6cbdb171a81b15ca56d7615d | train | function | @check_figures_equal(extensions=["png"])
def test_markerfacecolor_none_alpha(fig_test, fig_ref):
fig_test.subplots().plot(0, "o", mfc="none", alpha=.5)
fig_ref.subplots().plot(0, "o", mfc="w", alpha=.5)
| @check_figures_equal(extensions=["png"])
def test_markerfacecolor_none_alpha(fig_test, fig_ref):
| fig_test.subplots().plot(0, "o", mfc="none", alpha=.5)
fig_ref.subplots().plot(0, "o", mfc="w", alpha=.5)
| plot(x, y)
# Reference image
fig_ref.subplots().plot(x0, y0)
# pdf and svg tests fail using travis' old versions of gs and inkscape.
@check_figures_equal(extensions=["png"])
def test_markerfacecolor_none_alpha(fig_test, fig_ref):
| 64 | 64 | 66 | 24 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_markerfacecolor_none_alpha | test_markerfacecolor_none_alpha | 6,266 | 6,269 | 6,266 | 6,267 | 8ad566c01b4073274f8434616565b335d3812965 | bigcode/the-stack | train |
d5509de2a477645ce737f845 | train | function | def test_violinplot_outofrange_quantiles():
ax = plt.axes()
# First 9 digits of frac(sqrt(79))
np.random.seed(888194417)
data = [np.random.normal(size=100)]
# Quantile value above 100
with pytest.raises(ValueError):
ax.violinplot(data, quantiles=[[0.1, 0.2, 0.3, 1.05]])
#... | def test_violinplot_outofrange_quantiles():
| ax = plt.axes()
# First 9 digits of frac(sqrt(79))
np.random.seed(888194417)
data = [np.random.normal(size=100)]
# Quantile value above 100
with pytest.raises(ValueError):
ax.violinplot(data, quantiles=[[0.1, 0.2, 0.3, 1.05]])
# Quantile value below 0
with pytest.rais... | .normal(size=100)]
# Different size quantile list and plots
with pytest.raises(ValueError):
ax.violinplot(data, quantiles=[[0.1, 0.2], [0.5, 0.7]])
def test_violinplot_outofrange_quantiles():
| 63 | 64 | 144 | 11 | 52 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_violinplot_outofrange_quantiles | test_violinplot_outofrange_quantiles | 3,233 | 3,245 | 3,233 | 3,233 | d1c1b0938a98904961c0d8070e83778306004cde | bigcode/the-stack | train |
de681f25e4b729ab62e6f68e | train | function | @image_comparison(['hist_stacked_step'])
def test_hist_stacked_step():
# make some data
d1 = np.linspace(1, 3, 20)
d2 = np.linspace(0, 10, 50)
fig, ax = plt.subplots()
ax.hist((d1, d2), histtype="step", stacked=True)
| @image_comparison(['hist_stacked_step'])
def test_hist_stacked_step():
# make some data
| d1 = np.linspace(1, 3, 20)
d2 = np.linspace(0, 10, 50)
fig, ax = plt.subplots()
ax.hist((d1, d2), histtype="step", stacked=True)
| 0, 10, 50)
fig, ax = plt.subplots()
ax.hist((d1, d2), histtype="stepfilled", stacked=True, alpha=0.5)
@image_comparison(['hist_stacked_step'])
def test_hist_stacked_step():
# make some data
| 64 | 64 | 79 | 23 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stacked_step | test_hist_stacked_step | 3,679 | 3,685 | 3,679 | 3,681 | 6305ce9713112b9e4244d69b64ce0914536dde40 | bigcode/the-stack | train |
09c1c4a89a9b54e7f9add127 | train | function | def test_log_scales_invalid():
fig, ax = plt.subplots()
ax.set_xscale('log')
with pytest.warns(UserWarning, match='Attempted to set non-positive'):
ax.set_xlim(-1, 10)
ax.set_yscale('log')
with pytest.warns(UserWarning, match='Attempted to set non-positive'):
ax.set_ylim(-1, 1... | def test_log_scales_invalid():
| fig, ax = plt.subplots()
ax.set_xscale('log')
with pytest.warns(UserWarning, match='Attempted to set non-positive'):
ax.set_xlim(-1, 10)
ax.set_yscale('log')
with pytest.warns(UserWarning, match='Attempted to set non-positive'):
ax.set_ylim(-1, 10)
| ales_no_data():
_, ax = plt.subplots()
ax.set(xscale="log", yscale="log")
ax.xaxis.set_major_locator(mticker.MultipleLocator(1))
assert ax.get_xlim() == ax.get_ylim() == (1, 10)
def test_log_scales_invalid():
| 64 | 64 | 86 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_log_scales_invalid | test_log_scales_invalid | 2,539 | 2,546 | 2,539 | 2,539 | 71c12de71cb3049df1bd6eba9fc03bb470c8ca9b | bigcode/the-stack | train |
5edfd865384b9ce17aeb9b9f | train | function | def test_violin_point_mass():
"""Violin plot should handle point mass pdf gracefully."""
plt.violinplot(np.array([0, 0]))
| def test_violin_point_mass():
| """Violin plot should handle point mass pdf gracefully."""
plt.violinplot(np.array([0, 0]))
| ax.get_yscale() == 'linear'
assert ax.get_xscale() == 'linear'
def test_shared_bool():
with pytest.raises(TypeError):
plt.subplot(sharex=True)
with pytest.raises(TypeError):
plt.subplot(sharey=True)
def test_violin_point_mass():
| 64 | 64 | 33 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_violin_point_mass | test_violin_point_mass | 5,540 | 5,542 | 5,540 | 5,540 | 861700147be4cdf1fc332e380862a28cf8326897 | bigcode/the-stack | train |
db3445e2b7ad2b39cb656ea1 | train | function | def test_mismatched_ticklabels():
fig, ax = plt.subplots()
ax.plot(np.arange(10))
ax.xaxis.set_ticks([1.5, 2.5])
with pytest.raises(ValueError):
ax.xaxis.set_ticklabels(['a', 'b', 'c'])
| def test_mismatched_ticklabels():
| fig, ax = plt.subplots()
ax.plot(np.arange(10))
ax.xaxis.set_ticks([1.5, 2.5])
with pytest.raises(ValueError):
ax.xaxis.set_ticklabels(['a', 'b', 'c'])
| labels([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']
def test_mismatched_ticklabels():
| 63 | 64 | 63 | 8 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_mismatched_ticklabels | test_mismatched_ticklabels | 5,223 | 5,228 | 5,223 | 5,223 | ab6ee449f79dbff624ec43bf93d29af01c126189 | bigcode/the-stack | train |
438a4bdc5d57e503b043c559 | train | function | @image_comparison(['retain_tick_visibility.png'])
def test_retain_tick_visibility():
fig, ax = plt.subplots()
plt.plot([0, 1, 2], [0, -1, 4])
plt.setp(ax.get_yticklabels(), visible=False)
ax.tick_params(axis="y", which="both", length=0)
| @image_comparison(['retain_tick_visibility.png'])
def test_retain_tick_visibility():
| fig, ax = plt.subplots()
plt.plot([0, 1, 2], [0, -1, 4])
plt.setp(ax.get_yticklabels(), visible=False)
ax.tick_params(axis="y", which="both", length=0)
| to unset all tick labels
fig, ax = plt.subplots()
ax.bar([1, 2], [1, 2])
ax.set_xticks([1, 2])
ax.set_xticklabels([])
@image_comparison(['retain_tick_visibility.png'])
def test_retain_tick_visibility():
| 63 | 64 | 75 | 17 | 47 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_retain_tick_visibility | test_retain_tick_visibility | 5,239 | 5,244 | 5,239 | 5,240 | 2a42e267b3beca2348facece73fdb9f0c27ad6e5 | bigcode/the-stack | train |
496e78c6a07a4b19a6f024da | train | function | @image_comparison(['hist2d', 'hist2d'], remove_text=True, style='mpl20')
def test_hist2d():
# Remove this line when this test image is regenerated.
plt.rcParams['pcolormesh.snap'] = False
np.random.seed(0)
# make it not symmetric in case we switch x and y axis
x = np.random.randn(100)*2+5
... | @image_comparison(['hist2d', 'hist2d'], remove_text=True, style='mpl20')
def test_hist2d():
# Remove this line when this test image is regenerated.
| plt.rcParams['pcolormesh.snap'] = False
np.random.seed(0)
# make it not symmetric in case we switch x and y axis
x = np.random.randn(100)*2+5
y = np.random.randn(100)-2
fig, ax = plt.subplots()
ax.hist2d(x, y, bins=10, rasterized=True)
# Reuse testcase from above for a labeled... | , ax=ax)
cbar.add_lines(cs1)
cbar.add_lines(cs2, erase=False)
@image_comparison(['hist2d', 'hist2d'], remove_text=True, style='mpl20')
def test_hist2d():
# Remove this line when this test image is regenerated.
| 64 | 64 | 182 | 41 | 23 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist2d | test_hist2d | 2,086 | 2,101 | 2,086 | 2,088 | 817c54bd211d8e68d00137e12def1ac20d82a972 | bigcode/the-stack | train |
5736c4b96f05e8e8a940ee42 | train | function | def test_nodecorator():
with rc_context({'_internal.classic_mode': False}):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
fig.canvas.draw()
ax.set(xticklabels=[], yticklabels=[])
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
# test the axis bboxes
for nn, b i... | def test_nodecorator():
| with rc_context({'_internal.classic_mode': False}):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
fig.canvas.draw()
ax.set(xticklabels=[], yticklabels=[])
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
# test the axis bboxes
for nn, b in enumerate(bbaxis):
... | 75.88888, 1021.11, 1017.11]
targetbb = mtransforms.Bbox.from_bounds(*target)
assert_array_almost_equal(bbtb.bounds, targetbb.bounds, decimal=2)
# test that get_position roundtrips to get_window_extent
axbb = ax.get_position().transformed(fig.transFigure).bounds
assert_array_almost_equal(axbb,... | 105 | 105 | 350 | 5 | 100 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_nodecorator | test_nodecorator | 6,600 | 6,627 | 6,600 | 6,600 | 965324f96e6fc4c671636dabd62058bc61c1f861 | bigcode/the-stack | train |
3aff1b105cd68ca4500ead7d | train | function | def test_bar_label_labels():
ax = plt.gca()
rects = ax.bar([1, 2], [3, -4])
labels = ax.bar_label(rects, labels=['A', 'B'])
assert labels[0].get_text() == 'A'
assert labels[1].get_text() == 'B'
| def test_bar_label_labels():
| ax = plt.gca()
rects = ax.bar([1, 2], [3, -4])
labels = ax.bar_label(rects, labels=['A', 'B'])
assert labels[0].get_text() == 'A'
assert labels[1].get_text() == 'B'
| ([1, 2], [3, -4])
labels = ax.bar_label(rects, fmt='%.2f')
assert labels[0].get_text() == '3.00'
assert labels[1].get_text() == '-4.00'
def test_bar_label_labels():
| 63 | 64 | 73 | 6 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_label_labels | test_bar_label_labels | 7,129 | 7,134 | 7,129 | 7,129 | 1b882bae0f8ded55748085c91125ef716ecfd821 | bigcode/the-stack | train |
041749016a5fb0af441f8d75 | train | function | @image_comparison(['violinplot_vert_showmeans.png'])
def test_vert_violinplot_showmeans():
ax = plt.axes()
# First 9 digits of frac(sqrt(3))
np.random.seed(732050807)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=1, showextrema=0,
... | @image_comparison(['violinplot_vert_showmeans.png'])
def test_vert_violinplot_showmeans():
| ax = plt.axes()
# First 9 digits of frac(sqrt(3))
np.random.seed(732050807)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=1, showextrema=0,
showmedians=0)
| fig, ax = plt.subplots()
ax.violinplot("d", positions=range(4), showmeans=0, showextrema=0,
showmedians=0, data=data)
@image_comparison(['violinplot_vert_showmeans.png'])
def test_vert_violinplot_showmeans():
| 64 | 64 | 99 | 22 | 42 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_vert_violinplot_showmeans | test_vert_violinplot_showmeans | 3,072 | 3,079 | 3,072 | 3,073 | 37ca93de288dc0493b3b61cf3b92d668d82c270a | bigcode/the-stack | train |
2717e30a0d2bd016a6a42c50 | train | function | @image_comparison(['violinplot_horiz_showextrema.png'])
def test_horiz_violinplot_showextrema():
ax = plt.axes()
# First 9 digits of frac(sqrt(31))
np.random.seed(567764362)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
... | @image_comparison(['violinplot_horiz_showextrema.png'])
def test_horiz_violinplot_showextrema():
| ax = plt.axes()
# First 9 digits of frac(sqrt(31))
np.random.seed(567764362)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
showextrema=1, showmedians=0)
| range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=1,
showextrema=0, showmedians=0)
@image_comparison(['violinplot_horiz_showextrema.png'])
def test_horiz_violinplot_showextrema():
| 64 | 64 | 106 | 26 | 38 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_horiz_violinplot_showextrema | test_horiz_violinplot_showextrema | 3,163 | 3,170 | 3,163 | 3,164 | 6c8eead3fe4dd7e60c336417514aeeba739a63da | bigcode/the-stack | train |
4cfe0d32111a2ba028ba2632 | train | function | def test_violinplot_bad_positions():
ax = plt.axes()
# First 9 digits of frac(sqrt(47))
np.random.seed(855654600)
data = [np.random.normal(size=100) for _ in range(4)]
with pytest.raises(ValueError):
ax.violinplot(data, positions=range(5))
| def test_violinplot_bad_positions():
| ax = plt.axes()
# First 9 digits of frac(sqrt(47))
np.random.seed(855654600)
data = [np.random.normal(size=100) for _ in range(4)]
with pytest.raises(ValueError):
ax.violinplot(data, positions=range(5))
| data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
showextrema=0, showmedians=0, points=200)
def test_violinplot_bad_positions():
| 64 | 64 | 74 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_violinplot_bad_positions | test_violinplot_bad_positions | 3,204 | 3,210 | 3,204 | 3,204 | f750f8190dad54e145285dda1d31317d4e89b145 | bigcode/the-stack | train |
04b0cc703db70bfc844c031b | train | function | @check_figures_equal(extensions=['png'])
def test_stairs_update(fig_test, fig_ref):
# fixed ylim because stairs() does autoscale, but updating data does not
ylim = -3, 4
# Test
test_ax = fig_test.add_subplot()
h = test_ax.stairs([1, 2, 3])
test_ax.set_ylim(ylim)
h.set_data([3, 2, 1])... | @check_figures_equal(extensions=['png'])
def test_stairs_update(fig_test, fig_ref):
# fixed ylim because stairs() does autoscale, but updating data does not
| ylim = -3, 4
# Test
test_ax = fig_test.add_subplot()
h = test_ax.stairs([1, 2, 3])
test_ax.set_ylim(ylim)
h.set_data([3, 2, 1])
h.set_data(edges=np.arange(4)+2)
h.set_data([1, 2, 1], np.arange(4)/2)
h.set_data([1, 2, 3])
h.set_data(None, np.arange(4))
assert np.allc... | (h, h[-1]),
np.ones(len(h)+1)*bs, step='post', lw=0)
ref_axes[3].set_xlim(bs, None)
@check_figures_equal(extensions=['png'])
def test_stairs_update(fig_test, fig_ref):
# fixed ylim because stairs() does autoscale, but updating data does not
| 75 | 75 | 250 | 38 | 37 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stairs_update | test_stairs_update | 1,949 | 1,970 | 1,949 | 1,951 | 7254e1810c5c068a84489d1055e78da700f9e4bc | bigcode/the-stack | train |
cfb5fd0a9c5b0b09de18f2f3 | train | function | @pytest.mark.parametrize('data', [[[]], [[], [0, 1]], [[0, 1], []]])
@pytest.mark.parametrize('orientation', [None, 'vertical', 'horizontal'])
def test_eventplot_orientation(data, orientation):
"""Introduced when fixing issue #6412."""
opts = {} if orientation is None else {'orientation': orientation}
... | @pytest.mark.parametrize('data', [[[]], [[], [0, 1]], [[0, 1], []]])
@pytest.mark.parametrize('orientation', [None, 'vertical', 'horizontal'])
def test_eventplot_orientation(data, orientation):
| """Introduced when fixing issue #6412."""
opts = {} if orientation is None else {'orientation': orientation}
fig, ax = plt.subplots(1, 1)
ax.eventplot(data, **opts)
plt.draw()
| 0.0, 0.0)])
plt.draw()
@pytest.mark.parametrize('data', [[[]], [[], [0, 1]], [[0, 1], []]])
@pytest.mark.parametrize('orientation', [None, 'vertical', 'horizontal'])
def test_eventplot_orientation(data, orientation):
| 64 | 64 | 102 | 50 | 14 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_eventplot_orientation | test_eventplot_orientation | 4,109 | 4,116 | 4,109 | 4,111 | 789e8472fa5d8a9d6ed03c3456972dbfd03ad932 | bigcode/the-stack | train |
7ae2702f9bdb54fd2498f1d0 | train | function | @pytest.fixture(params=['x', 'y'])
def shared_axis_remover(request):
def _helper_x(ax):
ax2 = ax.twinx()
ax2.remove()
ax.set_xlim(0, 15)
r = ax.xaxis.get_major_locator()()
assert r[-1] > 14
def _helper_y(ax):
ax2 = ax.twiny()
ax2.remove()
... | @pytest.fixture(params=['x', 'y'])
def shared_axis_remover(request):
| def _helper_x(ax):
ax2 = ax.twinx()
ax2.remove()
ax.set_xlim(0, 15)
r = ax.xaxis.get_major_locator()()
assert r[-1] > 14
def _helper_y(ax):
ax2 = ax.twiny()
ax2.remove()
ax.set_ylim(0, 15)
r = ax.yaxis.get_major_locator()()
... | ()
ax.imshow(np.zeros((10, 10)))
assert ax.get_xbound() == (-0.5, 9.5)
assert ax.get_ybound() == (-0.5, 9.5)
@pytest.fixture(params=['x', 'y'])
def shared_axis_remover(request):
| 64 | 64 | 138 | 16 | 48 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | shared_axis_remover | shared_axis_remover | 5,682 | 5,698 | 5,682 | 5,683 | bc615b90ec220a4a4c1d3883e015b2f5e5819ea3 | bigcode/the-stack | train |
f41ea7d5513f75d17c4c9d09 | train | function | @image_comparison(['nonfinite_limits'])
def test_nonfinite_limits():
x = np.arange(0., np.e, 0.01)
# silence divide by zero warning from log(0)
with np.errstate(divide='ignore'):
y = np.log(x)
x[len(x)//2] = np.nan
fig, ax = plt.subplots()
ax.plot(x, y)
| @image_comparison(['nonfinite_limits'])
def test_nonfinite_limits():
| x = np.arange(0., np.e, 0.01)
# silence divide by zero warning from log(0)
with np.errstate(divide='ignore'):
y = np.log(x)
x[len(x)//2] = np.nan
fig, ax = plt.subplots()
ax.plot(x, y)
| )
# Test inverting nonlinear axes.
fig, ax = plt.subplots()
ax.set_yscale("log")
ax.set_ylim(10, 1)
assert ax.get_ylim() == (10, 1)
@image_comparison(['nonfinite_limits'])
def test_nonfinite_limits():
| 64 | 64 | 86 | 15 | 49 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_nonfinite_limits | test_nonfinite_limits | 822 | 830 | 822 | 823 | 73f6780018d24c69de91222b0c29b7f2360c50ee | bigcode/the-stack | train |
54cb5c4b04b8320f60353069 | train | function | @image_comparison(['bar_tick_label_multiple_old_label_alignment.png'])
def test_bar_tick_label_multiple_old_alignment():
# Test that the alignment for class is backward compatible
matplotlib.rcParams["ytick.alignment"] = "center"
ax = plt.gca()
ax.bar([1, 2.5], [1, 2], width=[0.2, 0.5], tick_label=... | @image_comparison(['bar_tick_label_multiple_old_label_alignment.png'])
def test_bar_tick_label_multiple_old_alignment():
# Test that the alignment for class is backward compatible
| matplotlib.rcParams["ytick.alignment"] = "center"
ax = plt.gca()
ax.bar([1, 2.5], [1, 2], width=[0.2, 0.5], tick_label=['a', 'b'],
align='center')
| , 2], width=[0.2, 0.5], tick_label=['a', 'b'],
align='center')
@image_comparison(['bar_tick_label_multiple_old_label_alignment.png'])
def test_bar_tick_label_multiple_old_alignment():
# Test that the alignment for class is backward compatible
| 63 | 64 | 97 | 35 | 28 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_tick_label_multiple_old_alignment | test_bar_tick_label_multiple_old_alignment | 1,531 | 1,537 | 1,531 | 1,533 | 2cafee539222869ad42d808f34654420166116e5 | bigcode/the-stack | train |
1689448045b49b80209a1ac9 | train | function | @image_comparison(['markevery_linear_scales_zoomed'], remove_text=True)
def test_markevery_linear_scales_zoomed():
cases = [None,
8,
(30, 8),
[16, 24, 30], [0, -1],
slice(100, 200, 3),
0.1, 0.3, 1.5,
(0.0, 0.1), (0.45, 0.1)]
... | @image_comparison(['markevery_linear_scales_zoomed'], remove_text=True)
def test_markevery_linear_scales_zoomed():
| cases = [None,
8,
(30, 8),
[16, 24, 30], [0, -1],
slice(100, 200, 3),
0.1, 0.3, 1.5,
(0.0, 0.1), (0.45, 0.1)]
cols = 3
gs = matplotlib.gridspec.GridSpec(len(cases) // cols + 1, cols)
delta = 0.11
x = np.linsp... | i // cols)
col = i % cols
plt.subplot(gs[row, col])
plt.title('markevery=%s' % str(case))
plt.plot(x, y, 'o', ls='-', ms=4, markevery=case)
@image_comparison(['markevery_linear_scales_zoomed'], remove_text=True)
def test_markevery_linear_scales_zoomed():
| 82 | 82 | 276 | 27 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_markevery_linear_scales_zoomed | test_markevery_linear_scales_zoomed | 1,413 | 1,437 | 1,413 | 1,414 | 371d475dfafafb667450c7d9fb6cc9eb2b16ed2e | bigcode/the-stack | train |
51b00f052c72d5104857081d | train | function | @image_comparison(['markevery_line'], remove_text=True, tol=0.005)
def test_markevery_line():
# TODO: a slight change in rendering between Inkscape versions may explain
# why one had to introduce a small non-zero tolerance for the SVG test
# to pass. One may try to remove this hack once Travis' Inkscape... | @image_comparison(['markevery_line'], remove_text=True, tol=0.005)
def test_markevery_line():
# TODO: a slight change in rendering between Inkscape versions may explain
# why one had to introduce a small non-zero tolerance for the SVG test
# to pass. One may try to remove this hack once Travis' Inkscape... | x = np.linspace(0, 10, 100)
y = np.sin(x) * np.sqrt(x/10 + 0.5)
# check line/marker combos
fig, ax = plt.subplots()
ax.plot(x, y, '-o', label='default')
ax.plot(x, y, '-d', markevery=None, label='mark all')
ax.plot(x, y, '-s', markevery=10, label='mark every 10')
ax.plot(x, y, '... | @image_comparison(['markevery_line'], remove_text=True, tol=0.005)
def test_markevery_line():
# TODO: a slight change in rendering between Inkscape versions may explain
# why one had to introduce a small non-zero tolerance for the SVG test
# to pass. One may try to remove this hack once Travis' Inkscape... | 105 | 72 | 241 | 105 | 0 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_markevery_line | test_markevery_line | 1,370 | 1,385 | 1,370 | 1,375 | 6f8dc7b234115c2028a87dcca864e58840bb6d0b | bigcode/the-stack | train |
4427d825e1845e6ced1e142e | train | function | @image_comparison(['markevery_polar'], style='default', remove_text=True)
def test_markevery_polar():
cases = [None,
8,
(30, 8),
[16, 24, 30], [0, -1],
slice(100, 200, 3),
0.1, 0.3, 1.5,
(0.0, 0.1), (0.45, 0.1)]
cols = 3
... | @image_comparison(['markevery_polar'], style='default', remove_text=True)
def test_markevery_polar():
| cases = [None,
8,
(30, 8),
[16, 24, 30], [0, -1],
slice(100, 200, 3),
0.1, 0.3, 1.5,
(0.0, 0.1), (0.45, 0.1)]
cols = 3
gs = matplotlib.gridspec.GridSpec(len(cases) // cols + 1, cols)
r = np.linspace(0, 3.0, 200)
... | s' % str(case))
plt.xscale('log')
plt.yscale('log')
plt.plot(x, y, 'o', ls='-', ms=4, markevery=case)
@image_comparison(['markevery_polar'], style='default', remove_text=True)
def test_markevery_polar():
| 69 | 69 | 233 | 25 | 44 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_markevery_polar | test_markevery_polar | 1,467 | 1,488 | 1,467 | 1,468 | ae52c9ad20227eefd7f959ae133b616fa52da09e | bigcode/the-stack | train |
4fc2a0dbe8901d08813148c6 | train | function | @image_comparison(['violinplot_horiz_custompoints_200.png'])
def test_horiz_violinplot_custompoints_200():
ax = plt.axes()
# First 9 digits of frac(sqrt(43))
np.random.seed(557438524)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, show... | @image_comparison(['violinplot_horiz_custompoints_200.png'])
def test_horiz_violinplot_custompoints_200():
| ax = plt.axes()
# First 9 digits of frac(sqrt(43))
np.random.seed(557438524)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
showextrema=0, showmedians=0, points=200)
| .violinplot(data, positions=range(4), vert=False, showmeans=0,
showextrema=0, showmedians=0, points=10)
@image_comparison(['violinplot_horiz_custompoints_200.png'])
def test_horiz_violinplot_custompoints_200():
| 64 | 64 | 112 | 28 | 36 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_horiz_violinplot_custompoints_200 | test_horiz_violinplot_custompoints_200 | 3,194 | 3,201 | 3,194 | 3,195 | 4b36daa55490a00ce2c5445707f6eef0b4a64445 | bigcode/the-stack | train |
d2ff8afa248e687114398b0e | train | function | @check_figures_equal(extensions=["png"])
def test_bar_decimal_width(fig_test, fig_ref):
x = [1.5, 8.4, 5.3, 4.2]
y = [1.1, 2.2, 3.3, 4.4]
w0 = [0.7, 1.45, 1, 2]
w = [Decimal(i) for i in w0]
# Test image - vertical bar chart with Decimal() width
ax = fig_test.subplots()
ax.bar(x, y, w... | @check_figures_equal(extensions=["png"])
def test_bar_decimal_width(fig_test, fig_ref):
| x = [1.5, 8.4, 5.3, 4.2]
y = [1.1, 2.2, 3.3, 4.4]
w0 = [0.7, 1.45, 1, 2]
w = [Decimal(i) for i in w0]
# Test image - vertical bar chart with Decimal() width
ax = fig_test.subplots()
ax.bar(x, y, width=w, align='center')
# Reference image
ax = fig_ref.subplots()
ax.bar(x,... | Reference image
ax = fig_ref.subplots()
ax.barh(x0, y0, height=[0.5, 0.5, 1, 1], align='center')
@check_figures_equal(extensions=["png"])
def test_bar_decimal_width(fig_test, fig_ref):
| 63 | 64 | 162 | 22 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_decimal_width | test_bar_decimal_width | 1,568 | 1,579 | 1,568 | 1,569 | b806f09520f6048024d6ff1515d68bc05376f70b | bigcode/the-stack | train |
9b03be53a43140f739a51a47 | train | function | @image_comparison(['bxp_custombox.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_custombox():
_bxp_test_helper(bxp_kwargs=dict(
boxprops=dict(linestyle='--', color='b', lw=3)))
| @image_comparison(['bxp_custombox.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_custombox():
| _bxp_test_helper(bxp_kwargs=dict(
boxprops=dict(linestyle='--', color='b', lw=3)))
| means=True,
meanprops=dict(linestyle='none', marker='d', mfc='green'),
))
@image_comparison(['bxp_custombox.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_custombox():
| 63 | 64 | 68 | 39 | 24 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_custombox | test_bxp_custombox | 2,705 | 2,711 | 2,705 | 2,709 | 31a86971b3ebe2494bdef129b5e4ac9d0d561be9 | bigcode/the-stack | train |
21c7d3702b407196089c830b | train | function | @image_comparison(['annotate_across_transforms.png'],
style='mpl20', remove_text=True)
def test_annotate_across_transforms():
x = np.linspace(0, 10, 200)
y = np.exp(-x) * np.sin(x)
fig, ax = plt.subplots(figsize=(3.39, 3))
ax.plot(x, y)
axins = ax.inset_axes([0.4, 0.5, 0.3... | @image_comparison(['annotate_across_transforms.png'],
style='mpl20', remove_text=True)
def test_annotate_across_transforms():
| x = np.linspace(0, 10, 200)
y = np.exp(-x) * np.sin(x)
fig, ax = plt.subplots(figsize=(3.39, 3))
ax.plot(x, y)
axins = ax.inset_axes([0.4, 0.5, 0.3, 0.3])
axins.set_aspect(0.2)
axins.xaxis.set_visible(False)
axins.yaxis.set_visible(False)
ax.annotate("", xy=(x[150], y[150])... | atter_empty_data():
# making sure this does not raise an exception
plt.scatter([], [])
plt.scatter([], [], s=[], c=[])
@image_comparison(['annotate_across_transforms.png'],
style='mpl20', remove_text=True)
def test_annotate_across_transforms():
| 64 | 64 | 187 | 33 | 31 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_annotate_across_transforms | test_annotate_across_transforms | 6,418 | 6,432 | 6,418 | 6,420 | b26490a581b37aea1b0888ced25a7b4b07b168de | bigcode/the-stack | train |
3fc003fabfbfccc63470327c | train | function | def test_hist_stacked_step_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,
histtype='step')
assert len(p... | def test_hist_stacked_step_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,
histtype='step')
assert len(patches) == 2
polygon, = patches[... | , 4], [2, 2], [3, 2],
[3, 1], [2, 1], [2, 3], [1, 3], [1, 2], [0, 2]]
assert_array_equal(polygon.get_xy(), xy)
def test_hist_stacked_step_geometry():
| 72 | 72 | 243 | 8 | 64 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stacked_step_geometry | test_hist_stacked_step_geometry | 3,771 | 3,788 | 3,771 | 3,771 | 4b6a6d156f0b38e9826e6992f7bda2065f920ad8 | bigcode/the-stack | train |
7a1193af81154b48a47b73d5 | train | function | @check_figures_equal(extensions=["png"])
def test_barh_decimal_center(fig_test, fig_ref):
ax = fig_test.subplots()
x0 = [1.5, 8.4, 5.3, 4.2]
y0 = [1.1, 2.2, 3.3, 4.4]
x = [Decimal(x) for x in x0]
y = [Decimal(y) for y in y0]
# Test image - horizontal, align-center bar chart with Decimal()... | @check_figures_equal(extensions=["png"])
def test_barh_decimal_center(fig_test, fig_ref):
| ax = fig_test.subplots()
x0 = [1.5, 8.4, 5.3, 4.2]
y0 = [1.1, 2.2, 3.3, 4.4]
x = [Decimal(x) for x in x0]
y = [Decimal(y) for y in y0]
# Test image - horizontal, align-center bar chart with Decimal() input
ax.barh(x, y, height=[0.5, 0.5, 1, 1], align='center')
# Reference image
... | Decimal() input
ax.bar(x, y, align='center')
# Reference image
ax = fig_ref.subplots()
ax.bar(x0, y0, align='center')
@check_figures_equal(extensions=["png"])
def test_barh_decimal_center(fig_test, fig_ref):
| 63 | 64 | 192 | 23 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_barh_decimal_center | test_barh_decimal_center | 1,554 | 1,565 | 1,554 | 1,555 | 8a925b9fbf0e78173009bb803cb86d60f6847e5e | bigcode/the-stack | train |
5e018085ceb9f235af580265 | train | function | def test_secondary_resize():
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
ax.secondary_xaxis('top', functions=(invert, invert))
fig.canvas.draw()
fig.set_size_inc... | def test_secondary_resize():
| 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
ax.secondary_xaxis('top', functions=(invert, invert))
fig.canvas.draw()
fig.set_size_inches((7, 4))
assert_allclo... | ))
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('bottom')
def test_secondary_resize():
| 63 | 64 | 121 | 5 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_secondary_resize | test_secondary_resize | 6,467 | 6,478 | 6,467 | 6,467 | 9903f2c04b502e412142eabbe8649c9b626a2d8f | bigcode/the-stack | train |
3cb342d65216f109bbe6e171 | train | function | @image_comparison(['hist_stacked_stepfilled', 'hist_stacked_stepfilled'])
def test_hist_stacked_stepfilled():
# 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)
# Reuse testcase from abo... | @image_comparison(['hist_stacked_stepfilled', 'hist_stacked_stepfilled'])
def test_hist_stacked_stepfilled():
# 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)
# Reuse testcase from above for a labeled data test
data = {"x": (d1, d2)}
fig, ax = plt.subplots()
ax.hist("x", histtype="stepfilled", stacked=... | 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth)
@image_comparison(['hist_stacked_stepfilled', 'hist_stacked_stepfilled'])
def test_hist_stacked_stepfilled():
# make some data
| 64 | 64 | 141 | 32 | 32 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stacked_stepfilled | test_hist_stacked_stepfilled | 3,568 | 3,579 | 3,568 | 3,570 | f78dcffacc8b1fde5c216495436fd7ee2b3f9fa3 | bigcode/the-stack | train |
e0a3f60d84db8ce820837a2b | train | function | def test_bxp_bad_widths():
with pytest.raises(ValueError):
_bxp_test_helper(bxp_kwargs=dict(widths=[1]))
| def test_bxp_bad_widths():
| with pytest.raises(ValueError):
_bxp_test_helper(bxp_kwargs=dict(widths=[1]))
| positions.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_custompositions():
_bxp_test_helper(bxp_kwargs=dict(positions=[1, 5, 6, 7]))
def test_bxp_bad_widths():
| 63 | 64 | 30 | 8 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_bad_widths | test_bxp_bad_widths | 2,819 | 2,821 | 2,819 | 2,819 | 16c37263a546770a456ea28081a377c76cc7484f | bigcode/the-stack | train |
b130e42747b4e5f6dc9a2ec3 | train | function | @image_comparison(['barh_tick_label.png'])
def test_barh_tick_label():
# From 2516: plot barh with array of string labels for y axis
ax = plt.gca()
ax.barh([1, 2.5], [1, 2], height=[0.2, 0.5], tick_label=['a', 'b'],
align='center')
| @image_comparison(['barh_tick_label.png'])
def test_barh_tick_label():
# From 2516: plot barh with array of string labels for y axis
| ax = plt.gca()
ax.barh([1, 2.5], [1, 2], height=[0.2, 0.5], tick_label=['a', 'b'],
align='center')
| 0, 0.3)
assert rect.get_edgecolor() == (0, 0, 0, 0)
@image_comparison(['barh_tick_label.png'])
def test_barh_tick_label():
# From 2516: plot barh with array of string labels for y axis
| 64 | 64 | 86 | 37 | 27 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_barh_tick_label | test_barh_tick_label | 1,612 | 1,617 | 1,612 | 1,614 | c9fc04573f3f4421f5341e2a62abdbe5f4f36657 | bigcode/the-stack | train |
668eaa2861892050d610abe1 | train | function | def test_errorbar_line_specific_kwargs():
# Check that passing line-specific keyword arguments will not result in
# errors.
x = np.arange(5)
y = np.arange(5)
plotline, _, _ = plt.errorbar(x, y, xerr=1, yerr=1, ls='None',
marker='s', fillstyle='full',
... | def test_errorbar_line_specific_kwargs():
# Check that passing line-specific keyword arguments will not result in
# errors.
| x = np.arange(5)
y = np.arange(5)
plotline, _, _ = plt.errorbar(x, y, xerr=1, yerr=1, ls='None',
marker='s', fillstyle='full',
drawstyle='steps-mid',
dash_capstyle='round',
... | ='none')
assert plotline is None
for errbar in barlines:
assert np.all(errbar.get_color() == mcolors.to_rgba('C0'))
def test_errorbar_line_specific_kwargs():
# Check that passing line-specific keyword arguments will not result in
# errors.
| 63 | 64 | 143 | 26 | 37 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_errorbar_line_specific_kwargs | test_errorbar_line_specific_kwargs | 3,462 | 3,476 | 3,462 | 3,464 | f52bb85005761301f30ff93d35ae25515a042260 | bigcode/the-stack | train |
691f66e8c6cd0125deb07798 | train | function | @image_comparison(['bxp_withmean_line.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_showmeanasline():
_bxp_test_helper(bxp_kwargs=dict(showmeans=True, meanline=True))
| @image_comparison(['bxp_withmean_line.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_showmeanasline():
| _bxp_test_helper(bxp_kwargs=dict(showmeans=True, meanline=True))
| _showmean():
_bxp_test_helper(bxp_kwargs=dict(showmeans=True, meanline=False))
@image_comparison(['bxp_withmean_line.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_showmeanasline():
| 63 | 64 | 60 | 42 | 21 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_showmeanasline | test_bxp_showmeanasline | 2,787 | 2,792 | 2,787 | 2,791 | dc08e70ff90fccb9767bb83ecc71e48e1dbb04bf | bigcode/the-stack | train |
55029f27578de6a8c66169f9 | train | function | def test_axis_extent_arg():
fig, ax = plt.subplots()
xmin = 5
xmax = 10
ymin = 15
ymax = 20
extent = ax.axis([xmin, xmax, ymin, ymax])
# test that the docstring is correct
assert tuple(extent) == (xmin, xmax, ymin, ymax)
# test that limits were set per the docstring
... | def test_axis_extent_arg():
| fig, ax = plt.subplots()
xmin = 5
xmax = 10
ymin = 15
ymax = 20
extent = ax.axis([xmin, xmax, ymin, ymax])
# test that the docstring is correct
assert tuple(extent) == (xmin, xmax, ymin, ymax)
# test that limits were set per the docstring
assert (xmin, xmax) == ax.ge... | 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")
def test_axis_extent_arg():
| 63 | 64 | 115 | 6 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axis_extent_arg | test_axis_extent_arg | 6,722 | 6,735 | 6,722 | 6,722 | 50b00fd47b820b3e1785abb8e14b362e8299a96f | bigcode/the-stack | train |
54058bacba9212841e9b95a4 | train | function | def test_move_offsetlabel():
data = np.random.random(10) * 1e-22
fig, ax = plt.subplots()
ax.plot(data)
fig.canvas.draw()
before = ax.yaxis.offsetText.get_position()
assert ax.yaxis.offsetText.get_horizontalalignment() == 'left'
ax.yaxis.tick_right()
fig.canvas.draw()
afte... | def test_move_offsetlabel():
| data = np.random.random(10) * 1e-22
fig, ax = plt.subplots()
ax.plot(data)
fig.canvas.draw()
before = ax.yaxis.offsetText.get_position()
assert ax.yaxis.offsetText.get_horizontalalignment() == 'left'
ax.yaxis.tick_right()
fig.canvas.draw()
after = ax.yaxis.offsetText.get_po... | \x9c\xd7\x95\xd7\x9d'
labels = [a.decode('utf-8'),
'hi aardvark',
b.decode('utf-8'),
]
ax.hist([range(15)] * 3, label=labels)
ax.legend()
def test_move_offsetlabel():
| 68 | 68 | 228 | 6 | 62 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_move_offsetlabel | test_move_offsetlabel | 5,368 | 5,391 | 5,368 | 5,368 | dade95cc2f37549a2070a58ba70ae2e5d70c508f | bigcode/the-stack | train |
11e4951235ad3d4ca66f5d12 | train | function | def test_pyplot_axes():
# test focusing of Axes in other Figure
fig1, ax1 = plt.subplots()
fig2, ax2 = plt.subplots()
plt.sca(ax1)
assert ax1 is plt.gca()
assert fig1 is plt.gcf()
plt.close(fig1)
plt.close(fig2)
| def test_pyplot_axes():
# test focusing of Axes in other Figure
| fig1, ax1 = plt.subplots()
fig2, ax2 = plt.subplots()
plt.sca(ax1)
assert ax1 is plt.gca()
assert fig1 is plt.gcf()
plt.close(fig1)
plt.close(fig2)
| plt.close()
# testing axes creation with subplot
ax = plt.subplot(121, projection=prj)
assert type(ax) == mpl.axes._subplots.subplot_class_factory(PolarAxes)
plt.close()
def test_pyplot_axes():
# test focusing of Axes in other Figure
| 64 | 64 | 74 | 17 | 47 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pyplot_axes | test_pyplot_axes | 2,512 | 2,520 | 2,512 | 2,513 | d03f861136dfde45d2fc4635434b7181730198e7 | bigcode/the-stack | train |
1694b2b785c62c73faaa424e | train | function | def test_patch_bounds(): # PR 19078
fig, ax = plt.subplots()
ax.add_patch(mpatches.Wedge((0, -1), 1.05, 60, 120, 0.1))
bot = 1.9*np.sin(15*np.pi/180)**2
np.testing.assert_array_almost_equal_nulp(
np.array((-0.525, -(bot+0.05), 1.05, bot+0.1)), ax.dataLim.bounds, 16)
| def test_patch_bounds(): # PR 19078
| fig, ax = plt.subplots()
ax.add_patch(mpatches.Wedge((0, -1), 1.05, 60, 120, 0.1))
bot = 1.9*np.sin(15*np.pi/180)**2
np.testing.assert_array_almost_equal_nulp(
np.array((-0.525, -(bot+0.05), 1.05, bot+0.1)), ax.dataLim.bounds, 16)
| = ax.bar_label(bars)
assert [l.get_text() for l in labels] == ['', '1']
assert labels[0].xy == (2, 0)
assert labels[0].get_va() == 'bottom'
def test_patch_bounds(): # PR 19078
| 63 | 64 | 114 | 12 | 51 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_patch_bounds | test_patch_bounds | 7,146 | 7,151 | 7,146 | 7,146 | ba1d7fbc1b199054fea10fe3f37a7f1f4baaa696 | bigcode/the-stack | train |
4fb04a6331d6899439f81b13 | train | function | def test_shared_with_aspect_2():
# Share 2 axes only with 'box':
fig, axs = plt.subplots(nrows=2, sharex=True, sharey=True)
axs[0].set_aspect(2, share=True)
axs[0].plot([1, 2], [3, 4])
axs[1].plot([3, 4], [1, 2])
plt.draw() # Trigger apply_aspect().
assert axs[0].get_xlim() == axs[1]... | def test_shared_with_aspect_2():
# Share 2 axes only with 'box':
| fig, axs = plt.subplots(nrows=2, sharex=True, sharey=True)
axs[0].set_aspect(2, share=True)
axs[0].plot([1, 2], [3, 4])
axs[1].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()
| axs = plt.subplots(nrows=2, sharex=True)
axs[0].set_aspect(2, adjustable=adjustable)
assert axs[1].get_aspect() == 'auto'
def test_shared_with_aspect_2():
# Share 2 axes only with 'box':
| 63 | 64 | 136 | 20 | 43 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_shared_with_aspect_2 | test_shared_with_aspect_2 | 4,897 | 4,905 | 4,897 | 4,898 | 2e9f149c8c2adf63785e8309347163d09bbe4a2d | bigcode/the-stack | train |
5dc433b33b26062881029d29 | train | function | @pytest.mark.parametrize('data, expected_number_of_hists',
[([], 1),
([[]], 1),
([[], []], 2)])
def test_hist_with_empty_input(data, expected_number_of_hists):
hists, _, _ = plt.hist(data)
hists = np.asarray(hists)
if hist... | @pytest.mark.parametrize('data, expected_number_of_hists',
[([], 1),
([[]], 1),
([[], []], 2)])
def test_hist_with_empty_input(data, expected_number_of_hists):
| hists, _, _ = plt.hist(data)
hists = np.asarray(hists)
if hists.ndim == 1:
assert 1 == expected_number_of_hists
else:
assert hists.shape[0] == expected_number_of_hists
| .assert_allclose(bins, mpl.dates.date2num(date_edges))
@pytest.mark.parametrize('data, expected_number_of_hists',
[([], 1),
([[]], 1),
([[], []], 2)])
def test_hist_with_empty_input(data, expected_number_of_hists):
| 63 | 64 | 107 | 48 | 15 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_with_empty_input | test_hist_with_empty_input | 1,853 | 1,864 | 1,853 | 1,857 | 2a9fd0c188c4e58a4a28a2a7e07c704a84738ece | bigcode/the-stack | train |
bc96f02719cce93789317ebc | train | function | @image_comparison(['pcolormesh_alpha'], extensions=["png", "pdf"],
remove_text=True)
def test_pcolormesh_alpha():
# Remove this line when this test image is regenerated.
plt.rcParams['pcolormesh.snap'] = False
n = 12
X, Y = np.meshgrid(
np.linspace(-1.5, 1.5, n),
... | @image_comparison(['pcolormesh_alpha'], extensions=["png", "pdf"],
remove_text=True)
def test_pcolormesh_alpha():
# Remove this line when this test image is regenerated.
| plt.rcParams['pcolormesh.snap'] = False
n = 12
X, Y = np.meshgrid(
np.linspace(-1.5, 1.5, n),
np.linspace(-1.5, 1.5, n*2)
)
Qx = X
Qy = Y + np.sin(X)
Z = np.hypot(X, Y) / 5
Z = (Z - Z.min()) / Z.ptp()
vir = plt.get_cmap("viridis", 16)
# make another c... | , ax3) = plt.subplots(1, 3)
ax1.pcolormesh(Qx, Qz, Z[:-1, :-1], lw=0.5, edgecolors='k')
ax2.pcolormesh(Qx, Qz, Z[:-1, :-1], lw=2, edgecolors=['b', 'w'])
ax3.pcolormesh(Qx, Qz, Z, shading="gouraud")
@image_comparison(['pcolormesh_alpha'], extensions=["png", "pdf"],
remove_text=True)
de... | 140 | 141 | 472 | 43 | 97 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pcolormesh_alpha | test_pcolormesh_alpha | 1,087 | 1,119 | 1,087 | 1,090 | 47c6fd2bb0c2f1eb7c07a80c717a55fe0467bdc2 | bigcode/the-stack | train |
eb77a26e2239b7b285d0f6f3 | train | function | def test_empty_errorbar_legend():
fig, ax = plt.subplots()
ax.errorbar([], [], xerr=[], label='empty y')
ax.errorbar([], [], yerr=[], label='empty x')
ax.legend()
| def test_empty_errorbar_legend():
| fig, ax = plt.subplots()
ax.errorbar([], [], xerr=[], label='empty y')
ax.errorbar([], [], yerr=[], label='empty x')
ax.legend()
| _equal(xtwin.viewLim.intervalx, ax2.viewLim.intervalx)
def test_zero_linewidth():
# Check that setting a zero linewidth doesn't error
plt.plot([0, 1], [0, 1], ls='--', lw=0)
def test_empty_errorbar_legend():
| 64 | 64 | 48 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_empty_errorbar_legend | test_empty_errorbar_legend | 6,246 | 6,250 | 6,246 | 6,246 | 3241100dc866e1fa61d029d2e440f45a37ada9b6 | bigcode/the-stack | train |
559d8407418ec0c48a62ac50 | train | function | def test_color_alias():
# issues 4157 and 4162
fig, ax = plt.subplots()
line = ax.plot([0, 1], c='lime')[0]
assert 'lime' == line.get_color()
| def test_color_alias():
# issues 4157 and 4162
| fig, ax = plt.subplots()
line = ax.plot([0, 1], c='lime')[0]
assert 'lime' == line.get_color()
| # Check that no warning is emitted.
def test_color_None():
# issue 3855
fig, ax = plt.subplots()
ax.plot([1, 2], [1, 2], color=None)
def test_color_alias():
# issues 4157 and 4162
| 64 | 64 | 51 | 16 | 48 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_color_alias | test_color_alias | 5,341 | 5,345 | 5,341 | 5,342 | 94a065976da12bd13c90d137b2998e79a57f687a | bigcode/the-stack | train |
b500a75b5fd2f2a413bf75aa | train | function | @image_comparison(['bxp_withnotch.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_shownotches():
_bxp_test_helper(bxp_kwargs=dict(shownotches=True))
| @image_comparison(['bxp_withnotch.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_shownotches():
| _bxp_test_helper(bxp_kwargs=dict(shownotches=True))
| _kwargs=dict(
whiskerprops=dict(linestyle='-', color='m', lw=3)))
@image_comparison(['bxp_withnotch.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_shownotches():
| 63 | 64 | 58 | 42 | 21 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_shownotches | test_bxp_shownotches | 2,741 | 2,746 | 2,741 | 2,745 | 7957c8b84e127dcdfe9ae7f063331e33ddef07b5 | bigcode/the-stack | train |
d988e1cc4d83659c9531ee5e | train | function | @image_comparison(['hlines_basic', 'hlines_with_nan', 'hlines_masked'],
extensions=['png'])
def test_hlines():
# normal
y1 = [2, 3, 4, 5, 7]
x1 = [2, -6, 3, 8, 2]
fig1, ax1 = plt.subplots()
ax1.hlines(y1, 0, x1, colors='g', linewidth=5)
# GH #7406
y2 = [2, 3, 4, ... | @image_comparison(['hlines_basic', 'hlines_with_nan', 'hlines_masked'],
extensions=['png'])
def test_hlines():
# normal
| y1 = [2, 3, 4, 5, 7]
x1 = [2, -6, 3, 8, 2]
fig1, ax1 = plt.subplots()
ax1.hlines(y1, 0, x1, colors='g', linewidth=5)
# GH #7406
y2 = [2, 3, 4, 5, 6, 7]
x2 = [2, -6, 3, 8, np.nan, 2]
fig2, (ax2, ax3, ax4) = plt.subplots(nrows=3, figsize=(4, 8))
ax2.hlines(y2, 0, x2, colors='... | -1, 0, 2, 1], 2)
ymax5 = np.ma.masked_equal([13, 14, 15, 16, 17, 18], 18)
ax5.vlines(x5, ymin5, ymax5, colors='k', linewidth=2)
ax5.set_xlim(0, 15)
def test_vlines_default():
fig, ax = plt.subplots()
with mpl.rc_context({'lines.color': 'red'}):
lines = ax.vlines(0.5, 0, 1)
... | 170 | 171 | 572 | 35 | 135 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hlines | test_hlines | 4,335 | 4,372 | 4,335 | 4,338 | 4f214106cdbc2d6120b48fd2677083ce3d1e40cb | bigcode/the-stack | train |
58f0a3611e8a319ba5ca9484 | train | function | def test_length_one_hist():
fig, ax = plt.subplots()
ax.hist(1)
ax.hist([1])
| def test_length_one_hist():
| fig, ax = plt.subplots()
ax.hist(1)
ax.hist([1])
| _limits():
mpl.style.use("default")
fig, ax = plt.subplots()
ax.plot([1, 2], [1, 2])
ax.set(xscale="log", xmargin=0)
assert ax.get_xlim() == (1, 2)
def test_length_one_hist():
| 64 | 64 | 26 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_length_one_hist | test_length_one_hist | 5,321 | 5,324 | 5,321 | 5,321 | 1999d24a3eec759844f00a6051084f1810f08977 | bigcode/the-stack | train |
30c8fd8d8fbde12a4468ce36 | train | function | @image_comparison(['aitoff_proj'], extensions=["png"],
remove_text=True, style='mpl20')
def test_aitoff_proj():
"""
Test aitoff projection ref.:
https://github.com/matplotlib/matplotlib/pull/14451
"""
x = np.linspace(-np.pi, np.pi, 20)
y = np.linspace(-np.pi / 2, np.pi ... | @image_comparison(['aitoff_proj'], extensions=["png"],
remove_text=True, style='mpl20')
def test_aitoff_proj():
| """
Test aitoff projection ref.:
https://github.com/matplotlib/matplotlib/pull/14451
"""
x = np.linspace(-np.pi, np.pi, 20)
y = np.linspace(-np.pi / 2, np.pi / 2, 20)
X, Y = np.meshgrid(x, y)
fig, ax = plt.subplots(figsize=(8, 4.2),
subplot_kw=dict(pr... | 0].plot("ones", "twos", data=pts)
axs[1].plot("ones", "twos", "r", data=pts)
@image_comparison(['aitoff_proj'], extensions=["png"],
remove_text=True, style='mpl20')
def test_aitoff_proj():
| 64 | 64 | 154 | 30 | 34 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_aitoff_proj | test_aitoff_proj | 690 | 704 | 690 | 692 | d49e6fd177ab7520598eb3ee66140baa1e4c7e5a | bigcode/the-stack | train |
b6a79853cda7685dd0b78fd6 | train | function | def test_shared_bool():
with pytest.raises(TypeError):
plt.subplot(sharex=True)
with pytest.raises(TypeError):
plt.subplot(sharey=True)
| def test_shared_bool():
| with pytest.raises(TypeError):
plt.subplot(sharex=True)
with pytest.raises(TypeError):
plt.subplot(sharey=True)
| axs[1, 1].set_xscale("linear")
axs[1, 1].set_yscale("linear")
for ax in axs.flat:
assert ax.get_yscale() == 'linear'
assert ax.get_xscale() == 'linear'
def test_shared_bool():
| 63 | 64 | 35 | 5 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_shared_bool | test_shared_bool | 5,533 | 5,537 | 5,533 | 5,533 | 47e336c6e968ac0334b2f7e11be9ab584991b7cf | bigcode/the-stack | train |
3c4db4da02654f484a3270b9 | train | function | def test_invisible_axes():
# invisible axes should not respond to events...
fig, ax = plt.subplots()
assert fig.canvas.inaxes((200, 200)) is not None
ax.set_visible(False)
assert fig.canvas.inaxes((200, 200)) is None
| def test_invisible_axes():
# invisible axes should not respond to events...
| fig, ax = plt.subplots()
assert fig.canvas.inaxes((200, 200)) is not None
ax.set_visible(False)
assert fig.canvas.inaxes((200, 200)) is None
| [0])
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_invisible_axes():
# invisible axes should not respond to events...
| 64 | 64 | 61 | 16 | 48 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_invisible_axes | test_invisible_axes | 6,899 | 6,904 | 6,899 | 6,900 | 8b9827084977ab5783c1d197379b37c59cd088dc | bigcode/the-stack | train |
a6b34c17b9f05b982eea4b46 | train | function | @image_comparison(['bxp_with_xlabels.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_with_xlabels():
def transform(stats):
for s, label in zip(stats, list('ABCD')):
s['label'] = label
return stats
_bxp_test_helper(transfor... | @image_comparison(['bxp_with_xlabels.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_with_xlabels():
| def transform(stats):
for s, label in zip(stats, list('ABCD')):
s['label'] = label
return stats
_bxp_test_helper(transform_stats=transform)
| def test_bxp_percentilewhis():
_bxp_test_helper(stats_kwargs=dict(whis=[5, 95]))
@image_comparison(['bxp_with_xlabels.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_with_xlabels():
| 63 | 64 | 79 | 36 | 27 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_with_xlabels | test_bxp_with_xlabels | 2,633 | 2,642 | 2,633 | 2,636 | cbe9778cedca2721ea1f8a0d8a3e80c8592b066f | bigcode/the-stack | train |
266180d8dba020363e3bbf0c | train | function | def test_bar_edgecolor_none_alpha():
ax = plt.gca()
rects = ax.bar([1, 2], [2, 4], alpha=0.3, color='r', edgecolor='none')
for rect in rects:
assert rect.get_facecolor() == (1, 0, 0, 0.3)
assert rect.get_edgecolor() == (0, 0, 0, 0)
| def test_bar_edgecolor_none_alpha():
| ax = plt.gca()
rects = ax.bar([1, 2], [2, 4], alpha=0.3, color='r', edgecolor='none')
for rect in rects:
assert rect.get_facecolor() == (1, 0, 0, 0.3)
assert rect.get_edgecolor() == (0, 0, 0, 0)
| none', edgecolor='r')
for rect in rects:
assert rect.get_facecolor() == (0, 0, 0, 0)
assert rect.get_edgecolor() == (1, 0, 0, 0.3)
def test_bar_edgecolor_none_alpha():
| 64 | 64 | 97 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_edgecolor_none_alpha | test_bar_edgecolor_none_alpha | 1,604 | 1,609 | 1,604 | 1,604 | 207f161704868bb5de90ecc035f511d9b59f32a3 | bigcode/the-stack | train |
988c9505b3e79ce5954b034e | train | function | @check_figures_equal(extensions=["png"])
def test_violinplot_pandas_series(fig_test, fig_ref, pd):
np.random.seed(110433579)
s1 = pd.Series(np.random.normal(size=7), index=[9, 8, 7, 6, 5, 4, 3])
s2 = pd.Series(np.random.normal(size=9), index=list('ABCDEFGHI'))
s3 = pd.Series(np.random.normal(size=1... | @check_figures_equal(extensions=["png"])
def test_violinplot_pandas_series(fig_test, fig_ref, pd):
| np.random.seed(110433579)
s1 = pd.Series(np.random.normal(size=7), index=[9, 8, 7, 6, 5, 4, 3])
s2 = pd.Series(np.random.normal(size=9), index=list('ABCDEFGHI'))
s3 = pd.Series(np.random.normal(size=11))
fig_test.subplots().violinplot([s1, s2, s3])
fig_ref.subplots().violinplot([s1.values, ... | # Reference image
ax = fig_ref.subplots()
ax.violinplot(data, quantiles=[[0.1, 0.3, 0.9]])
@check_figures_equal(extensions=["png"])
def test_violinplot_pandas_series(fig_test, fig_ref, pd):
| 63 | 64 | 141 | 27 | 36 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_violinplot_pandas_series | test_violinplot_pandas_series | 3,264 | 3,271 | 3,264 | 3,265 | 97b01f0049acd39b9abf051d58b6228d1039dbdd | bigcode/the-stack | train |
19f752254af1fd8bfedfbc0f | train | function | @image_comparison(['bxp_rangewhis.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_rangewhis():
_bxp_test_helper(stats_kwargs=dict(whis=[0, 100]))
| @image_comparison(['bxp_rangewhis.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_rangewhis():
| _bxp_test_helper(stats_kwargs=dict(whis=[0, 100]))
| arg={'dpi': 40},
style='default')
def test_bxp_baseline():
_bxp_test_helper()
@image_comparison(['bxp_rangewhis.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_rangewhis():
| 64 | 64 | 56 | 38 | 26 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_rangewhis | test_bxp_rangewhis | 2,619 | 2,623 | 2,619 | 2,622 | dc703e7b9af18370ee6f02aeb08f40fa255291ee | bigcode/the-stack | train |
1dde801e695af1073af9b1a8 | train | function | def test_hist_stepfilled_geometry():
bins = [0, 1, 2, 3]
data = [0, 0, 1, 1, 1, 2]
_, _, (polygon, ) = plt.hist(data,
bins=bins,
histtype='stepfilled')
xy = [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1],
[3, 0],... | def test_hist_stepfilled_geometry():
| bins = [0, 1, 2, 3]
data = [0, 0, 1, 1, 1, 2]
_, _, (polygon, ) = plt.hist(data,
bins=bins,
histtype='stepfilled')
xy = [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1],
[3, 0], [2, 0], [2, 0], [1, 0], [1, 0], [0, 0... | _text=True)
def test_hist_step_bottom():
# make some data
d1 = np.linspace(1, 3, 20)
fig, ax = plt.subplots()
ax.hist(d1, bottom=np.arange(10), histtype="stepfilled")
def test_hist_stepfilled_geometry():
| 63 | 64 | 160 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stepfilled_geometry | test_hist_stepfilled_geometry | 3,705 | 3,713 | 3,705 | 3,705 | 14ab39534c9a66b35bb81747bfa17241df96640f | bigcode/the-stack | train |
3c6b345852c3bb919cfb8fa0 | train | function | @image_comparison(['violinplot_horiz_showmeans.png'])
def test_horiz_violinplot_showmeans():
ax = plt.axes()
# First 9 digits of frac(sqrt(29))
np.random.seed(385164807)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=1,
... | @image_comparison(['violinplot_horiz_showmeans.png'])
def test_horiz_violinplot_showmeans():
| ax = plt.axes()
# First 9 digits of frac(sqrt(29))
np.random.seed(385164807)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=1,
showextrema=0, showmedians=0)
| _ in range(4)]
ax.violinplot(data, positions=range(4), vert=False, showmeans=0,
showextrema=0, showmedians=1)
@image_comparison(['violinplot_horiz_showmeans.png'])
def test_horiz_violinplot_showmeans():
| 64 | 64 | 104 | 24 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_horiz_violinplot_showmeans | test_horiz_violinplot_showmeans | 3,153 | 3,160 | 3,153 | 3,154 | 1a9d2a32d8f1f4ba80dd314839163dd5acd95c80 | bigcode/the-stack | train |
892d95aab196e47f25ac0369 | train | function | def test_pandas_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_index_shape(pd):
| df = pd.DataFrame({"XX": [4, 5, 6], "YY": [7, 1, 2]})
fig, ax = plt.subplots()
ax.plot(df.index, df['YY'])
| 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_index_shape(pd):
| 64 | 64 | 57 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pandas_index_shape | test_pandas_index_shape | 5,818 | 5,821 | 5,818 | 5,818 | a4333515c1f076a16ac13a21ad825056913357dd | bigcode/the-stack | train |
577ae4e9546661b511805bde | train | function | def generate_errorbar_inputs():
base_xy = cycler('x', [np.arange(5)]) + cycler('y', [np.ones(5)])
err_cycler = cycler('err', [1,
[1, 1, 1, 1, 1],
[[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1]],
... | def generate_errorbar_inputs():
| base_xy = cycler('x', [np.arange(5)]) + cycler('y', [np.ones(5)])
err_cycler = cycler('err', [1,
[1, 1, 1, 1, 1],
[[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1]],
np.ones(5),
... |
def test_shared_bool():
with pytest.raises(TypeError):
plt.subplot(sharex=True)
with pytest.raises(TypeError):
plt.subplot(sharey=True)
def test_violin_point_mass():
"""Violin plot should handle point mass pdf gracefully."""
plt.violinplot(np.array([0, 0]))
def generate_... | 75 | 76 | 256 | 6 | 69 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | generate_errorbar_inputs | generate_errorbar_inputs | 5,545 | 5,564 | 5,545 | 5,545 | 16adfa73c41216f863d76625e53925964c2e80b1 | bigcode/the-stack | train |
1c67fc09694f6d377a9818e7 | train | function | @check_figures_equal()
def test_errorbar_cycle_ecolor(fig_test, fig_ref):
x = np.arange(0.1, 4, 0.5)
y = [np.exp(-x+n) for n in range(4)]
axt = fig_test.subplots()
axr = fig_ref.subplots()
for yi, color in zip(y, ['C0', 'C1', 'C2', 'C3']):
axt.errorbar(x, yi, yerr=(yi * 0.25), lin... | @check_figures_equal()
def test_errorbar_cycle_ecolor(fig_test, fig_ref):
| x = np.arange(0.1, 4, 0.5)
y = [np.exp(-x+n) for n in range(4)]
axt = fig_test.subplots()
axr = fig_ref.subplots()
for yi, color in zip(y, ['C0', 'C1', 'C2', 'C3']):
axt.errorbar(x, yi, yerr=(yi * 0.25), linestyle='-',
marker='o', ecolor='black')
axr.e... | assert mcolors.to_rgba(e2.get_color()) == mcolors.to_rgba('C1')
assert mcolors.to_rgba(ln1.get_color()) == mcolors.to_rgba('C2')
@check_figures_equal()
def test_errorbar_cycle_ecolor(fig_test, fig_ref):
| 63 | 64 | 166 | 19 | 44 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_errorbar_cycle_ecolor | test_errorbar_cycle_ecolor | 3,371 | 3,383 | 3,371 | 3,372 | c6ea46dee85a196ecb0bf906d97d3b4810fd19c2 | bigcode/the-stack | train |
333ec5b2fb5b857f609b6a36 | train | function | @image_comparison(['marker_edges'], remove_text=True)
def test_marker_edges():
x = np.linspace(0, 1, 10)
fig, ax = plt.subplots()
ax.plot(x, np.sin(x), 'y.', ms=30.0, mew=0, mec='r')
ax.plot(x+0.1, np.sin(x), 'y.', ms=30.0, mew=1, mec='r')
ax.plot(x+0.2, np.sin(x), 'y.', ms=30.0, mew=2, mec='b... | @image_comparison(['marker_edges'], remove_text=True)
def test_marker_edges():
| x = np.linspace(0, 1, 10)
fig, ax = plt.subplots()
ax.plot(x, np.sin(x), 'y.', ms=30.0, mew=0, mec='r')
ax.plot(x+0.1, np.sin(x), 'y.', ms=30.0, mew=1, mec='r')
ax.plot(x+0.2, np.sin(x), 'y.', ms=30.0, mew=2, mec='b')
| plt.subplot(gs[row, col], polar=True)
plt.title('markevery=%s' % str(case))
plt.plot(theta, r, 'o', ls='-', ms=4, markevery=case)
@image_comparison(['marker_edges'], remove_text=True)
def test_marker_edges():
| 64 | 64 | 128 | 17 | 47 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_marker_edges | test_marker_edges | 1,491 | 1,497 | 1,491 | 1,492 | 52240b4f2fc08b739ece4831ed4a79fd92d200ec | bigcode/the-stack | train |
023cabba9b22e0559eaf2fc0 | train | function | def test_hist_nan_data():
fig, (ax1, ax2) = plt.subplots(2)
data = [1, 2, 3]
nan_data = data + [np.nan]
bins, edges, _ = ax1.hist(data)
with np.errstate(invalid='ignore'):
nanbins, nanedges, _ = ax2.hist(nan_data)
np.testing.assert_allclose(bins, nanbins)
np.testing.ass... | def test_hist_nan_data():
| fig, (ax1, ax2) = plt.subplots(2)
data = [1, 2, 3]
nan_data = data + [np.nan]
bins, edges, _ = ax1.hist(data)
with np.errstate(invalid='ignore'):
nanbins, nanedges, _ = ax2.hist(nan_data)
np.testing.assert_allclose(bins, nanbins)
np.testing.assert_allclose(edges, nanedge... | 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_nan_data():
| 64 | 64 | 105 | 6 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_nan_data | test_hist_nan_data | 6,757 | 6,768 | 6,757 | 6,757 | 3b6a613193d4460668f04b30bd1f9b4122ad727c | bigcode/the-stack | train |
9a481a829fdb8039931470af | train | function | @check_figures_equal(extensions=["png"])
def test_violinplot_single_list_quantiles(fig_test, fig_ref):
# Ensures quantile list for 1D can be passed in as single list
# First 9 digits of frac(sqrt(83))
np.random.seed(110433579)
data = [np.random.normal(size=100)]
# Test image
ax = fig_te... | @check_figures_equal(extensions=["png"])
def test_violinplot_single_list_quantiles(fig_test, fig_ref):
# Ensures quantile list for 1D can be passed in as single list
# First 9 digits of frac(sqrt(83))
| np.random.seed(110433579)
data = [np.random.normal(size=100)]
# Test image
ax = fig_test.subplots()
ax.violinplot(data, quantiles=[0.1, 0.3, 0.9])
# Reference image
ax = fig_ref.subplots()
ax.violinplot(data, quantiles=[[0.1, 0.3, 0.9]])
| 0.75]])
@check_figures_equal(extensions=["png"])
def test_violinplot_single_list_quantiles(fig_test, fig_ref):
# Ensures quantile list for 1D can be passed in as single list
# First 9 digits of frac(sqrt(83))
| 63 | 64 | 152 | 58 | 5 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_violinplot_single_list_quantiles | test_violinplot_single_list_quantiles | 3,248 | 3,261 | 3,248 | 3,251 | 6a497d1ebce8090b4be6ad69904431f14bd1bd07 | bigcode/the-stack | train |
f73142bef6c85391c6ac8f79 | train | function | @image_comparison(['bxp_baseline.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_baseline():
_bxp_test_helper()
| @image_comparison(['bxp_baseline.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_baseline():
| _bxp_test_helper()
| .boxprops.linewidth'] = \
mpl.rcParams['lines.linewidth']
ax.bxp(transform_stats(logstats), **bxp_kwargs)
@image_comparison(['bxp_baseline.png'],
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_baseline():
| 64 | 64 | 41 | 34 | 30 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_baseline | test_bxp_baseline | 2,612 | 2,616 | 2,612 | 2,615 | 235b0a20f90577887f08b7ba1a4eb7bd1ee2ebbf | bigcode/the-stack | train |
7203cd69983243f8409bef5d | train | function | def test_stairs_invalid_update():
h = plt.stairs([1, 2], [0, 1, 2])
with pytest.raises(ValueError, match='Nan values in "edges"'):
h.set_data(edges=[1, np.nan, 2])
| def test_stairs_invalid_update():
| h = plt.stairs([1, 2], [0, 1, 2])
with pytest.raises(ValueError, match='Nan values in "edges"'):
h.set_data(edges=[1, np.nan, 2])
| plt.stairs([1, 2], [0, np.nan, 1])
def test_stairs_invalid_mismatch():
with pytest.raises(ValueError, match='Size mismatch'):
plt.stairs([1, 2], [0, 1])
def test_stairs_invalid_update():
| 63 | 64 | 58 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stairs_invalid_update | test_stairs_invalid_update | 2,003 | 2,006 | 2,003 | 2,003 | b9790f686751ed390f3e214d63ed11ca53628306 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.