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
a48ad09ceaec2efaef3651a0
train
function
def test_datetime_masked(): # make sure that all-masked data falls back to the viewlim # set in convert.axisinfo.... x = np.array([datetime.datetime(2017, 1, n) for n in range(1, 6)]) y = np.array([1, 2, 3, 4, 5]) m = np.ma.masked_greater(y, 0) fig, ax = plt.subplots() ax.plot(x, m)...
def test_datetime_masked(): # make sure that all-masked data falls back to the viewlim # set in convert.axisinfo....
x = np.array([datetime.datetime(2017, 1, n) for n in range(1, 6)]) y = np.array([1, 2, 3, 4, 5]) m = np.ma.masked_greater(y, 0) fig, ax = plt.subplots() ax.plot(x, m) dt = mdates.date2num(np.datetime64('0000-12-31')) assert ax.get_xlim() == (730120.0 + dt, 733773.0 + dt)
limits were set per the docstring assert (xmin, xmax) == ax.get_xlim() assert (ymin, ymax) == ax.get_ylim() def test_datetime_masked(): # make sure that all-masked data falls back to the viewlim # set in convert.axisinfo....
64
64
150
31
33
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_datetime_masked
test_datetime_masked
6,738
6,748
6,738
6,740
7da8fa325f799e2e83de76d762caf91d1c19b1eb
bigcode/the-stack
train
9a75aa64b0d2b1e283e08980
train
function
def test_artist_sublists(): fig, ax = plt.subplots() lines = [ax.plot(np.arange(i, i + 5))[0] for i in range(6)] col = ax.scatter(np.arange(5), np.arange(5)) im = ax.imshow(np.zeros((5, 5))) patch = ax.add_patch(mpatches.Rectangle((0, 0), 5, 5)) text = ax.text(0, 0, 'foo') # Get ite...
def test_artist_sublists():
fig, ax = plt.subplots() lines = [ax.plot(np.arange(i, i + 5))[0] for i in range(6)] col = ax.scatter(np.arange(5), np.arange(5)) im = ax.imshow(np.zeros((5, 5))) patch = ax.add_patch(mpatches.Rectangle((0, 0), 5, 5)) text = ax.text(0, 0, 'foo') # Get items, which should not be mixed...
() for l in labels] == ['', '1'] assert labels[0].xy == (2, 0) assert labels[0].get_va() == 'bottom' 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...
229
230
769
7
222
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_artist_sublists
test_artist_sublists
7,164
7,240
7,164
7,164
cc022139685935f460413cd950997e64307f3e28
bigcode/the-stack
train
13ee4db62c1098daa8871c1a
train
function
def test_pie_get_negative_values(): # Test the ValueError raised when feeding negative values into axes.pie fig, ax = plt.subplots() with pytest.raises(ValueError): ax.pie([5, 5, -3], explode=[0, .1, .2])
def test_pie_get_negative_values(): # Test the ValueError raised when feeding negative values into axes.pie
fig, ax = plt.subplots() with pytest.raises(ValueError): ax.pie([5, 5, -3], explode=[0, .1, .2])
"] assert tx.get_rotation_mode() == textprops["rotation_mode"] assert tx.get_size() == textprops["size"] assert tx.get_color() == textprops["color"] def test_pie_get_negative_values(): # Test the ValueError raised when feeding negative values into axes.pie
63
64
62
24
39
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_pie_get_negative_values
test_pie_get_negative_values
5,147
5,151
5,147
5,148
e0aacc229c043405486bf00cb1bd9a81fdee6f04
bigcode/the-stack
train
cffbfacc77ab30f4ab49cebc
train
function
def test_ytickcolor_is_not_yticklabelcolor(): plt.rcParams['ytick.color'] = 'yellow' plt.rcParams['ytick.labelcolor'] = 'blue' ax = plt.axes() ticks = ax.yaxis.get_major_ticks() for tick in ticks: assert tick.tick1line.get_color() == 'yellow' assert tick.label1.get_color() == ...
def test_ytickcolor_is_not_yticklabelcolor():
plt.rcParams['ytick.color'] = 'yellow' plt.rcParams['ytick.labelcolor'] = 'blue' ax = plt.axes() ticks = ax.yaxis.get_major_ticks() for tick in ticks: assert tick.tick1line.get_color() == 'yellow' assert tick.label1.get_color() == 'blue'
blue' ax = plt.axes() ticks = ax.xaxis.get_major_ticks() for tick in ticks: assert tick.tick1line.get_color() == 'yellow' assert tick.label1.get_color() == 'blue' def test_ytickcolor_is_not_yticklabelcolor():
63
64
88
14
49
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_ytickcolor_is_not_yticklabelcolor
test_ytickcolor_is_not_yticklabelcolor
6,969
6,976
6,969
6,969
74bd16f6f619759ffa552731cd7ac699dc43898e
bigcode/the-stack
train
ea181cd6a44d34e6fc338c8a
train
function
@mpl.style.context('default') @pytest.mark.parametrize('plot_fun', ['scatter', 'plot', 'fill_between']) @check_figures_equal(extensions=["png"]) def test_limits_empty_data(plot_fun, fig_test, fig_ref): # Check that plotting empty data doesn't change autoscaling of dates x = np.ara...
@mpl.style.context('default') @pytest.mark.parametrize('plot_fun', ['scatter', 'plot', 'fill_between']) @check_figures_equal(extensions=["png"]) def test_limits_empty_data(plot_fun, fig_test, fig_ref): # Check that plotting empty data doesn't change autoscaling of dates
x = np.arange("2010-01-01", "2011-01-01", dtype="datetime64[D]") ax_test = fig_test.subplots() ax_ref = fig_ref.subplots() getattr(ax_test, plot_fun)([], []) for ax in [ax_test, ax_ref]: getattr(ax, plot_fun)(x, range(len(x)), color='C0')
@mpl.style.context('default') @pytest.mark.parametrize('plot_fun', ['scatter', 'plot', 'fill_between']) @check_figures_equal(extensions=["png"]) def test_limits_empty_data(plot_fun, fig_test, fig_ref): # Check that plotting empty data doesn't change autoscaling of dates
64
64
148
64
0
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_limits_empty_data
test_limits_empty_data
833
847
833
838
2de9f2b398f1597308213f6889a1efc1955b1b92
bigcode/the-stack
train
d9a79f47e0b9fcc870c8134a
train
function
@image_comparison(['rgba_markers'], remove_text=True) def test_rgba_markers(): fig, axs = plt.subplots(ncols=2) rcolors = [(1, 0, 0, 1), (1, 0, 0, 0.5)] bcolors = [(0, 0, 1, 1), (0, 0, 1, 0.5)] alphas = [None, 0.2] kw = dict(ms=100, mew=20) for i, alpha in enumerate(alphas): for ...
@image_comparison(['rgba_markers'], remove_text=True) def test_rgba_markers():
fig, axs = plt.subplots(ncols=2) rcolors = [(1, 0, 0, 1), (1, 0, 0, 0.5)] bcolors = [(0, 0, 1, 1), (0, 0, 1, 0.5)] alphas = [None, 0.2] kw = dict(ms=100, mew=20) for i, alpha in enumerate(alphas): for j, rcolor in enumerate(rcolors): for k, bcolor in enumerate(bcolors)...
def test_transparent_markers(): np.random.seed(0) data = np.random.random(50) fig, ax = plt.subplots() ax.plot(data, 'D', mfc='none', markersize=100) @image_comparison(['rgba_markers'], remove_text=True) def test_rgba_markers():
69
69
230
20
49
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_rgba_markers
test_rgba_markers
3,888
3,902
3,888
3,889
b964415fb528d149b654364e2646f95109965e48
bigcode/the-stack
train
cb2603e11fc06a1d1a20aa6b
train
function
def test_boxplot_not_single(): fig, ax = plt.subplots() ax.boxplot(np.random.rand(100), positions=[3]) ax.boxplot(np.random.rand(100), positions=[5]) fig.canvas.draw() assert ax.get_xlim() == (2.5, 5.5) assert list(ax.get_xticks()) == [3, 5] assert [t.get_text() for t in ax.get_xtickl...
def test_boxplot_not_single():
fig, ax = plt.subplots() ax.boxplot(np.random.rand(100), positions=[3]) ax.boxplot(np.random.rand(100), positions=[5]) fig.canvas.draw() assert ax.get_xlim() == (2.5, 5.5) assert list(ax.get_xticks()) == [3, 5] assert [t.get_text() for t in ax.get_xticklabels()] == ["3", "5"]
) y2 = np.random.normal(3, 1, 20) ax.boxplot([y1, y2], positions=[1, 2], manage_ticks=False) new_xlim = ax.get_xlim() assert_array_equal(old_xlim, new_xlim) def test_boxplot_not_single():
64
64
102
7
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_boxplot_not_single
test_boxplot_not_single
3,286
3,293
3,286
3,286
6de17fa03c706758dc582151523e1c7dd9214247
bigcode/the-stack
train
a3c8501214d82521a667433f
train
function
def test_empty_shared_subplots(): # empty plots with shared axes inherit limits from populated plots fig, axs = plt.subplots(nrows=1, ncols=2, sharex=True, sharey=True) axs[0].plot([1, 2, 3], [2, 4, 6]) x0, x1 = axs[1].get_xlim() y0, y1 = axs[1].get_ylim() assert x0 <= 1 assert x1 >= ...
def test_empty_shared_subplots(): # empty plots with shared axes inherit limits from populated plots
fig, axs = plt.subplots(nrows=1, ncols=2, sharex=True, sharey=True) axs[0].plot([1, 2, 3], [2, 4, 6]) x0, x1 = axs[1].get_xlim() y0, y1 = axs[1].get_ylim() assert x0 <= 1 assert x1 >= 3 assert y0 <= 2 assert y1 >= 6
(*args, xmin=bad_lim, xmax=1) with pytest.raises(ValueError, match='xmax must be a single scalar value'): fh(*args, xmin=1, xmax=bad_lim) def test_empty_shared_subplots(): # empty plots with shared axes inherit limits from populated plots
64
64
129
20
44
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_empty_shared_subplots
test_empty_shared_subplots
4,872
4,881
4,872
4,873
587be3c4fdf328b18cc056da38dd3a30c4ac664b
bigcode/the-stack
train
70f8a511ef8a3e668b083a37
train
function
def test_relim_visible_only(): x1 = (0., 10.) y1 = (0., 10.) x2 = (-10., 20.) y2 = (-10., 30.) fig = matplotlib.figure.Figure() ax = fig.add_subplot() ax.plot(x1, y1) assert ax.get_xlim() == x1 assert ax.get_ylim() == y1 line, = ax.plot(x2, y2) assert ax.get_xlim...
def test_relim_visible_only():
x1 = (0., 10.) y1 = (0., 10.) x2 = (-10., 20.) y2 = (-10., 30.) fig = matplotlib.figure.Figure() ax = fig.add_subplot() ax.plot(x1, y1) assert ax.get_xlim() == x1 assert ax.get_ylim() == y1 line, = ax.plot(x2, y2) assert ax.get_xlim() == x2 assert ax.get_ylim...
twiny ax_twin = getattr(ax, 'twin{}'.format(twin))() ax.set_aspect(5) ax_twin.set_aspect(2) assert_array_equal(ax.bbox.extents, ax_twin.bbox.extents) def test_relim_visible_only():
64
64
189
7
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_relim_visible_only
test_relim_visible_only
4,939
4,961
4,939
4,939
a8003100b4c7e23c86e4b464f5a1a41e450cc620
bigcode/the-stack
train
e4e48c0d6d92ad373f517908
train
function
@image_comparison(['violinplot_horiz_showall.png']) def test_horiz_violinplot_showall(): ax = plt.axes() # First 9 digits of frac(sqrt(37)) np.random.seed(82762530) data = [np.random.normal(size=100) for _ in range(4)] ax.violinplot(data, positions=range(4), vert=False, showmeans=1, ...
@image_comparison(['violinplot_horiz_showall.png']) def test_horiz_violinplot_showall():
ax = plt.axes() # First 9 digits of frac(sqrt(37)) np.random.seed(82762530) data = [np.random.normal(size=100) for _ in range(4)] ax.violinplot(data, positions=range(4), vert=False, showmeans=1, showextrema=1, showmedians=1, quantiles=[[0.1, 0.9], [0.2, 0.8]...
_ in range(4)] ax.violinplot(data, positions=range(4), vert=False, showmeans=0, showextrema=1, showmedians=0) @image_comparison(['violinplot_horiz_showall.png']) def test_horiz_violinplot_showall():
64
64
148
24
40
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_horiz_violinplot_showall
test_horiz_violinplot_showall
3,173
3,181
3,173
3,174
ac70791320fa9316fc11f675d7f127e4cb8449a1
bigcode/the-stack
train
faa926895426209f4d6be8fd
train
function
@image_comparison(['pie_center_radius.png']) def test_pie_center_radius(): # The slices will be ordered and plotted counter-clockwise. labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' sizes = [15, 30, 45, 10] colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral'] explode = (0, 0.1, 0, 0) # on...
@image_comparison(['pie_center_radius.png']) def test_pie_center_radius(): # The slices will be ordered and plotted counter-clockwise.
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' sizes = [15, 30, 45, 10] colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral'] explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs') plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', ...
ex", labels="l", colors="c", autopct='%1.1f%%', shadow=True, startangle=90, wedgeprops={'linewidth': 0}, data=data) plt.axis('equal') @image_comparison(['pie_center_radius.png']) def test_pie_center_radius(): # The slices will be ordered and plotted counter-clockwise.
76
77
257
30
46
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_pie_center_radius
test_pie_center_radius
5,019
5,036
5,019
5,021
f1453382a921aac073f87eab13d06dc4be18732c
bigcode/the-stack
train
e37f63282b4bff2ec8ba21af
train
function
@image_comparison(['bxp_with_ylabels.png'], savefig_kwarg={'dpi': 40}, style='default', tol=0.1) def test_bxp_with_ylabels(): def transform(stats): for s, label in zip(stats, list('ABCD')): s['label'] = label return stats ...
@image_comparison(['bxp_with_ylabels.png'], savefig_kwarg={'dpi': 40}, style='default', tol=0.1) def test_bxp_with_ylabels():
def transform(stats): for s, label in zip(stats, list('ABCD')): s['label'] = label return stats _bxp_test_helper(transform_stats=transform, bxp_kwargs=dict(vert=False))
def test_bxp_horizontal(): _bxp_test_helper(bxp_kwargs=dict(vert=False)) @image_comparison(['bxp_with_ylabels.png'], savefig_kwarg={'dpi': 40}, style='default', tol=0.1) def test_bxp_with_ylabels():
63
64
94
43
20
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bxp_with_ylabels
test_bxp_with_ylabels
2,654
2,664
2,654
2,658
6e42cbeb6da351e8cfefd71002db00e6f461bc24
bigcode/the-stack
train
066027a6b2845936f608c4bd
train
function
def test_offset_text_visible(): fig, ax = plt.subplots() ax.plot([1.01e9, 1.02e9, 1.03e9]) ax.yaxis.set_tick_params(label1On=False, label2On=True) assert ax.yaxis.get_offset_text().get_visible() ax.yaxis.set_tick_params(label2On=False) assert not ax.yaxis.get_offset_text().get_visible()
def test_offset_text_visible():
fig, ax = plt.subplots() ax.plot([1.01e9, 1.02e9, 1.03e9]) ax.yaxis.set_tick_params(label1On=False, label2On=True) assert ax.yaxis.get_offset_text().get_visible() ax.yaxis.set_tick_params(label2On=False) assert not ax.yaxis.get_offset_text().get_visible()
ax = plt.subplots() ax.plot([1.01e9, 1.02e9, 1.03e9]) ax.yaxis.set_tick_params(labelcolor='red') assert ax.yaxis.get_offset_text().get_color() == 'red' def test_offset_text_visible():
63
64
92
6
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_offset_text_visible
test_offset_text_visible
6,073
6,079
6,073
6,073
e9945882c473e89306d39e193c464078710ac803
bigcode/the-stack
train
14f633818a31d9dca598fe48
train
function
def color_boxes(fig, ax): """ Helper for the tests below that test the extents of various axes elements """ fig.canvas.draw() renderer = fig.canvas.get_renderer() bbaxis = [] for nn, axx in enumerate([ax.xaxis, ax.yaxis]): bb = axx.get_tightbbox(renderer) if bb: ...
def color_boxes(fig, ax):
""" Helper for the tests below that test the extents of various axes elements """ fig.canvas.draw() renderer = fig.canvas.get_renderer() bbaxis = [] for nn, axx in enumerate([ax.xaxis, ax.yaxis]): bb = axx.get_tightbbox(renderer) if bb: axisr = plt.Rect...
plt.draw() assert isinstance(secax._axis.get_minor_locator(), mticker.LogLocator) ax.set_xscale('linear') plt.draw() assert isinstance(secax._axis.get_minor_locator(), mticker.NullLocator) def test_secondary_formatter(): fig, ax = plt.subpl...
127
127
424
7
120
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
color_boxes
color_boxes
6,515
6,558
6,515
6,515
2836fbfad4274b5fea7425180c7d3b6ef10b3e33
bigcode/the-stack
train
d34032808ffb6f5d7eeac934
train
function
@check_figures_equal() def test_axline_transaxes(fig_test, fig_ref): ax = fig_test.subplots() ax.set(xlim=(-1, 1), ylim=(-1, 1)) ax.axline((0, 0), slope=1, transform=ax.transAxes) ax.axline((1, 0.5), slope=1, color='C1', transform=ax.transAxes) ax.axline((0.5, 0.5), slope=0, color='C2', transf...
@check_figures_equal() def test_axline_transaxes(fig_test, fig_ref):
ax = fig_test.subplots() ax.set(xlim=(-1, 1), ylim=(-1, 1)) ax.axline((0, 0), slope=1, transform=ax.transAxes) ax.axline((1, 0.5), slope=1, color='C1', transform=ax.transAxes) ax.axline((0.5, 0.5), slope=0, color='C2', transform=ax.transAxes) ax.axline((0.5, 0), (0.5, 1), color='C3', transf...
ax.axhline(-0.5, color='C3') ax.plot([-1, 1], [0.5, -0.5], color='C4') ax.axvline(-0.5, color='C5') @check_figures_equal() def test_axline_transaxes(fig_test, fig_ref):
72
73
246
18
54
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_axline_transaxes
test_axline_transaxes
4,231
4,245
4,231
4,232
09eefd684dd19d392d845cd785f731764c71234a
bigcode/the-stack
train
d8f009453bd325f0d4d31b7a
train
function
@mpl.style.context('default') @check_figures_equal() def test_bar_hatches(fig_test, fig_ref): ax_test = fig_test.subplots() ax_ref = fig_ref.subplots() x = [1, 2] y = [2, 3] hatches = ['x', 'o'] for i in range(2): ax_ref.bar(x[i], y[i], color='C0', hatch=hatches[i]) ax_...
@mpl.style.context('default') @check_figures_equal() def test_bar_hatches(fig_test, fig_ref):
ax_test = fig_test.subplots() ax_ref = fig_ref.subplots() x = [1, 2] y = [2, 3] hatches = ['x', 'o'] for i in range(2): ax_ref.bar(x[i], y[i], color='C0', hatch=hatches[i]) ax_test.bar(x, y, hatch=hatches)
, .4, .6]}, index=[1, 2, 3]) fig, ax = plt.subplots() ax.bar(df.x, 1., width=df.width) @mpl.style.context('default') @check_figures_equal() def test_bar_hatches(fig_test, fig_ref):
64
64
108
24
40
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bar_hatches
test_bar_hatches
1,712
1,724
1,712
1,714
ae5fed58bd4952919736b134ce7ac50590196bd0
bigcode/the-stack
train
d5f9831a0b125d997c632328
train
function
@pytest.mark.parametrize( 'y, x1, x2', [ (np.zeros((2, 2)), 3, 3), (np.arange(0.0, 2, 0.02), np.zeros((2, 2)), 3), (np.arange(0.0, 2, 0.02), 3, np.zeros((2, 2))) ], ids=[ '2d_y_input', '2d_x1_input', '2d_x2_input' ] ) def test_fill_betweenx_input(y,...
@pytest.mark.parametrize( 'y, x1, x2', [ (np.zeros((2, 2)), 3, 3), (np.arange(0.0, 2, 0.02), np.zeros((2, 2)), 3), (np.arange(0.0, 2, 0.02), 3, np.zeros((2, 2))) ], ids=[ '2d_y_input', '2d_x1_input', '2d_x2_input' ] ) def test_fill_betweenx_input(y,...
fig, ax = plt.subplots() with pytest.raises(ValueError): ax.fill_betweenx(y, x1, x2)
@pytest.mark.parametrize( 'y, x1, x2', [ (np.zeros((2, 2)), 3, 3), (np.arange(0.0, 2, 0.02), np.zeros((2, 2)), 3), (np.arange(0.0, 2, 0.02), 3, np.zeros((2, 2))) ], ids=[ '2d_y_input', '2d_x1_input', '2d_x2_input' ] ) def test_fill_betweenx_input(y,...
132
64
160
132
0
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_fill_betweenx_input
test_fill_betweenx_input
936
950
936
947
b25a6e2c4db1a59d9cd34cfad54b668fa73548d7
bigcode/the-stack
train
327bbe8f878b7dc8e5763f5c
train
function
@check_figures_equal(extensions=["png"]) def test_pcolornearest(fig_test, fig_ref): ax = fig_test.subplots() x = np.arange(0, 10) y = np.arange(0, 3) np.random.seed(19680801) Z = np.random.randn(2, 9) ax.pcolormesh(x, y, Z, shading='flat') ax = fig_ref.subplots() # specify the...
@check_figures_equal(extensions=["png"]) def test_pcolornearest(fig_test, fig_ref):
ax = fig_test.subplots() x = np.arange(0, 10) y = np.arange(0, 3) np.random.seed(19680801) Z = np.random.randn(2, 9) ax.pcolormesh(x, y, Z, shading='flat') ax = fig_ref.subplots() # specify the centers x2 = x[:-1] + np.diff(x) / 2 y2 = y[:-1] + np.diff(y) / 2 ax.p...
= np.zeros(X.shape) with pytest.warns(UserWarning, match='are not monotonically increasing or decreasing'): ax.pcolormesh(X, Y, Z, shading='auto') @check_figures_equal(extensions=["png"]) def test_pcolornearest(fig_test, fig_ref):
63
64
153
22
41
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_pcolornearest
test_pcolornearest
1,210
1,223
1,210
1,211
aa96f0f2356122132c4cf4a2c05c897fb614a8fe
bigcode/the-stack
train
9915179b0cc1eae17312011f
train
function
@image_comparison(['fill_between_interpolate'], remove_text=True) def test_fill_between_interpolate(): x = np.arange(0.0, 2, 0.02) y1 = np.sin(2*np.pi*x) y2 = 1.2*np.sin(4*np.pi*x) fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) ax1.plot(x, y1, x, y2, color='black') ax1.fill_between(x...
@image_comparison(['fill_between_interpolate'], remove_text=True) def test_fill_between_interpolate():
x = np.arange(0.0, 2, 0.02) y1 = np.sin(2*np.pi*x) y2 = 1.2*np.sin(4*np.pi*x) fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) ax1.plot(x, y1, x, y2, color='black') ax1.fill_between(x, y1, y2, where=y2 >= y1, facecolor='white', hatch='/', interpolate=True) ax1....
'2d_y_input', '2d_x1_input', '2d_x2_input' ] ) def test_fill_betweenx_input(y, x1, x2): fig, ax = plt.subplots() with pytest.raises(ValueError): ax.fill_betweenx(y, x1, x2) @image_comparison(['fill_between_interpolate'], remove_text=True) def test_fill_between_interp...
89
89
298
21
68
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_fill_between_interpolate
test_fill_between_interpolate
953
974
953
954
bd0f1d8fe55a6f9c9d0b7387f67506bf09aaabfb
bigcode/the-stack
train
7d14de825f37a91b4ea098d1
train
function
@image_comparison(['axisbelow.png'], remove_text=True) def test_axisbelow(): # Test 'line' setting added in 6287. # Show only grids, not frame or ticks, to make this test # independent of future change to drawing order of those elements. axs = plt.figure().subplots(ncols=3, sharex=True, sharey=True...
@image_comparison(['axisbelow.png'], remove_text=True) def test_axisbelow(): # Test 'line' setting added in 6287. # Show only grids, not frame or ticks, to make this test # independent of future change to drawing order of those elements.
axs = plt.figure().subplots(ncols=3, sharex=True, sharey=True) settings = (False, 'line', True) for ax, setting in zip(axs, settings): ax.plot((0, 10), (0, 10), lw=10, color='m') circ = mpatches.Circle((3, 3), color='r') ax.add_patch(circ) ax.grid(color='c', linestyle...
ydate=True) @image_comparison(['axisbelow.png'], remove_text=True) def test_axisbelow(): # Test 'line' setting added in 6287. # Show only grids, not frame or ticks, to make this test # independent of future change to drawing order of those elements.
64
64
199
60
4
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_axisbelow
test_axisbelow
5,982
5,998
5,982
5,986
733eae2002111588a68e024997dbffd5b52db156
bigcode/the-stack
train
48260ace106b3f5ae41280c2
train
function
def test_axis_set_tick_params_labelsize_labelcolor(): # Tests fix for issue 4346 axis_1 = plt.subplot() axis_1.yaxis.set_tick_params(labelsize=30, labelcolor='red', direction='out') # Expected values after setting the ticks assert axis_1.yaxis.majorTicks[0]._...
def test_axis_set_tick_params_labelsize_labelcolor(): # Tests fix for issue 4346
axis_1 = plt.subplot() axis_1.yaxis.set_tick_params(labelsize=30, labelcolor='red', direction='out') # Expected values after setting the ticks assert axis_1.yaxis.majorTicks[0]._size == 4.0 assert axis_1.yaxis.majorTicks[0].tick1line.get_color() == 'k' as...
) with pytest.warns(MatplotlibDeprecationWarning, match="The apply_tickdir function was deprecated in " "Matplotlib 3.5"): tick.apply_tickdir('out') def test_axis_set_tick_params_labelsize_labelcolor(): # Tests fix for issue 4346
63
64
147
21
42
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_axis_set_tick_params_labelsize_labelcolor
test_axis_set_tick_params_labelsize_labelcolor
5,862
5,872
5,862
5,863
af167abde80c86be4bebd1f16cf498907c9e48d7
bigcode/the-stack
train
8ffca6d6c4f46c1ebb32f281
train
function
def test_pcolorargs(): n = 12 x = np.linspace(-1.5, 1.5, n) y = np.linspace(-1.5, 1.5, n*2) X, Y = np.meshgrid(x, y) Z = np.hypot(X, Y) / 5 _, ax = plt.subplots() with pytest.raises(TypeError): ax.pcolormesh(y, x, Z) with pytest.raises(TypeError): ax.pcolormes...
def test_pcolorargs():
n = 12 x = np.linspace(-1.5, 1.5, n) y = np.linspace(-1.5, 1.5, n*2) X, Y = np.meshgrid(x, y) Z = np.hypot(X, Y) / 5 _, ax = plt.subplots() with pytest.raises(TypeError): ax.pcolormesh(y, x, Z) with pytest.raises(TypeError): ax.pcolormesh(X, Y, Z.T) with p...
0) y = np.repeat(y[:, np.newaxis], 21, axis=1) plt.subplot(223) plt.pcolor(x[:-1, :-1], y[:-1, :-1], z[:-1, :-1]) plt.subplot(224) plt.pcolor(x, y, z) for ax in fig.get_axes(): for label in ax.get_xticklabels(): label.set_ha('right') label.set_rotation(30...
105
105
351
6
99
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_pcolorargs
test_pcolorargs
1,177
1,207
1,177
1,177
3041a006986f09af51a4c7391afc22c6057fdf4d
bigcode/the-stack
train
f69a6d3d2c1a7c64ce5a07ad
train
function
@image_comparison(['hexbin_empty.png'], remove_text=True) def test_hexbin_empty(): # From #3886: creating hexbin from empty dataset raises ValueError ax = plt.gca() ax.hexbin([], [])
@image_comparison(['hexbin_empty.png'], remove_text=True) def test_hexbin_empty(): # From #3886: creating hexbin from empty dataset raises ValueError
ax = plt.gca() ax.hexbin([], [])
ax.hexbin("x", "y", extent=[.1, .3, .6, .7], data=data) @image_comparison(['hexbin_empty.png'], remove_text=True) def test_hexbin_empty(): # From #3886: creating hexbin from empty dataset raises ValueError
64
64
51
37
27
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hexbin_empty
test_hexbin_empty
753
757
753
755
1faa9e39a822f5d7ec6134ee2b9733f41fd5edc7
bigcode/the-stack
train
b7745994881e9f88985fa653
train
function
@image_comparison(['markevery_linear_scales'], remove_text=True, tol=0.001) def test_markevery_linear_scales(): 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)] c...
@image_comparison(['markevery_linear_scales'], remove_text=True, tol=0.001) def test_markevery_linear_scales():
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...
s', markevery=10, label='mark every 10') ax.plot(x, y, '-+', markevery=(5, 20), label='mark every 5 starting at 10') ax.legend() @image_comparison(['markevery_linear_scales'], remove_text=True, tol=0.001) def test_markevery_linear_scales():
75
75
252
29
46
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_markevery_linear_scales
test_markevery_linear_scales
1,388
1,410
1,388
1,389
a05e5b7009bad567dad06ad263af0b66a6b494b3
bigcode/the-stack
train
73f859b6104f32dd648faa5f
train
function
def test_tick_padding_tightbbox(): """Test that tick padding gets turned off if axis is off""" plt.rcParams["xtick.direction"] = "out" plt.rcParams["ytick.direction"] = "out" fig, ax = plt.subplots() bb = ax.get_tightbbox(fig.canvas.get_renderer()) ax.axis('off') bb2 = ax.get_tightbbo...
def test_tick_padding_tightbbox():
"""Test that tick padding gets turned off if axis is off""" plt.rcParams["xtick.direction"] = "out" plt.rcParams["ytick.direction"] = "out" fig, ax = plt.subplots() bb = ax.get_tightbbox(fig.canvas.get_renderer()) ax.axis('off') bb2 = ax.get_tightbbox(fig.canvas.get_renderer()) as...
) 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) def test_tick_padding_tightbbox():
64
64
111
8
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_tick_padding_tightbbox
test_tick_padding_tightbbox
6,272
6,281
6,272
6,272
6d2058c7c8730381d2ba24469f5d72adc73c1221
bigcode/the-stack
train
ec355c22dae4546670636538
train
function
@image_comparison(['canonical']) def test_canonical(): fig, ax = plt.subplots() ax.plot([1, 2, 3])
@image_comparison(['canonical']) def test_canonical():
fig, ax = plt.subplots() ax.plot([1, 2, 3])
+ np.diff(x) / 2 y2 = y[:-1] + np.diff(y) / 2 # this is same as nearest: ax.pcolormesh(x2, y2, Z, snap=snap) @image_comparison(['canonical']) def test_canonical():
64
64
32
12
52
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_canonical
test_canonical
1,271
1,274
1,271
1,272
c9f47629c473ce92b35a606d33552835e0889d0b
bigcode/the-stack
train
fce6a6daf82767f492b66b3c
train
function
def test_hist_unequal_bins_density(): # Test correct behavior of normalized histogram with unequal bins # https://github.com/matplotlib/matplotlib/issues/9557 rng = np.random.RandomState(57483) t = rng.randn(100) bins = [-3, -1, -0.5, 0, 1, 5] mpl_heights, _, _ = plt.hist(t, bins=bins, den...
def test_hist_unequal_bins_density(): # Test correct behavior of normalized histogram with unequal bins # https://github.com/matplotlib/matplotlib/issues/9557
rng = np.random.RandomState(57483) t = rng.randn(100) bins = [-3, -1, -0.5, 0, 1, 5] mpl_heights, _, _ = plt.hist(t, bins=bins, density=True) np_heights, _ = np.histogram(t, bins=bins, density=True) assert_allclose(mpl_heights, np_heights)
data = np.random.standard_normal(2000) fig, ax = plt.subplots() ax.hist(data, density=True) def test_hist_unequal_bins_density(): # Test correct behavior of normalized histogram with unequal bins # https://github.com/matplotlib/matplotlib/issues/9557
64
64
131
38
26
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hist_unequal_bins_density
test_hist_unequal_bins_density
1,811
1,819
1,811
1,813
656139838d3b158a1d87e0eb0f2a3287c1448ae9
bigcode/the-stack
train
fa45b5108478ddf5a1d2ddd4
train
function
@check_figures_equal(extensions=["png"]) def test_acorr(fig_test, fig_ref): np.random.seed(19680801) Nx = 512 x = np.random.normal(0, 1, Nx).cumsum() maxlags = Nx-1 ax_test = fig_test.subplots() ax_test.acorr(x, maxlags=maxlags) ax_ref = fig_ref.subplots() # Normalized autoc...
@check_figures_equal(extensions=["png"]) def test_acorr(fig_test, fig_ref):
np.random.seed(19680801) Nx = 512 x = np.random.normal(0, 1, Nx).cumsum() maxlags = Nx-1 ax_test = fig_test.subplots() ax_test.acorr(x, maxlags=maxlags) ax_ref = fig_ref.subplots() # Normalized autocorrelation norm_auto_corr = np.correlate(x, x, mode="full")/np.dot(x, x) ...
X Label', x=1, ha='right') cbar = fig_ref.colorbar(sc, orientation='horizontal') cbar.set_label("Z Label", x=1, ha='right') @check_figures_equal(extensions=["png"]) def test_acorr(fig_test, fig_ref):
63
64
188
21
42
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_acorr
test_acorr
107
123
107
108
9394948937d48cfe89e1885de3c3d29b1b763801
bigcode/the-stack
train
e6bb8a31c5d52774c0c561b6
train
function
def test_secondary_formatter(): fig, ax = plt.subplots() ax.set_xscale("log") secax = ax.secondary_xaxis("top") secax.xaxis.set_major_formatter(mticker.ScalarFormatter()) fig.canvas.draw() assert isinstance( secax.xaxis.get_major_formatter(), mticker.ScalarFormatter)
def test_secondary_formatter():
fig, ax = plt.subplots() ax.set_xscale("log") secax = ax.secondary_xaxis("top") secax.xaxis.set_major_formatter(mticker.ScalarFormatter()) fig.canvas.draw() assert isinstance( secax.xaxis.get_major_formatter(), mticker.ScalarFormatter)
) ax.set_xscale('log') plt.draw() assert isinstance(secax._axis.get_minor_locator(), mticker.LogLocator) ax.set_xscale('linear') plt.draw() assert isinstance(secax._axis.get_minor_locator(), mticker.NullLocator) def test_secondary_formatter(): ...
64
64
70
5
59
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_secondary_formatter
test_secondary_formatter
6,505
6,512
6,505
6,505
9aced7c702b13c2818cbbe3e44b0981c698251f5
bigcode/the-stack
train
c78b94f0375f0f4973ace9d3
train
function
@image_comparison(['twin_spines_on_top.png', 'twin_spines_on_top.png'], remove_text=True) def test_twin_spines_on_top(): matplotlib.rcParams['axes.linewidth'] = 48.0 matplotlib.rcParams['lines.linewidth'] = 48.0 fig = plt.figure() ax1 = fig.add_subplot(1, 1, 1) data = np...
@image_comparison(['twin_spines_on_top.png', 'twin_spines_on_top.png'], remove_text=True) def test_twin_spines_on_top():
matplotlib.rcParams['axes.linewidth'] = 48.0 matplotlib.rcParams['lines.linewidth'] = 48.0 fig = plt.figure() ax1 = fig.add_subplot(1, 1, 1) data = np.array([[1000, 1100, 1200, 1250], [310, 301, 360, 400]]) ax2 = ax1.twinx() ax1.plot(data[0], data[1]/1E3, ...
= dict(size=4, width=1.5) host.tick_params(axis='y', colors=p1.get_color(), **tkw) par1.tick_params(axis='y', colors=p2.get_color(), **tkw) par2.tick_params(axis='y', colors=p3.get_color(), **tkw) host.tick_params(axis='x', **tkw) @image_comparison(['twin_spines_on_top.png', 'twin_spines_on_top.png...
116
116
387
36
80
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_twin_spines_on_top
test_twin_spines_on_top
4,753
4,781
4,753
4,755
25ba0f08cc416411b72fdf3eb2b52be193fbbbd9
bigcode/the-stack
train
5be61692c83be57c0ae053de
train
function
@image_comparison(['pie_ccw_true.png']) def test_pie_ccw_true(): # The slices will be ordered and plotted counter-clockwise. labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' sizes = [15, 30, 45, 10] colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral'] explode = (0, 0.1, 0, 0) # only "explod...
@image_comparison(['pie_ccw_true.png']) def test_pie_ccw_true(): # The slices will be ordered and plotted counter-clockwise.
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' sizes = [15, 30, 45, 10] colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral'] explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs') plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', ...
wedgeprops={'linewidth': 2}) # Set aspect ratio to be equal so that pie is drawn as a circle. plt.axis('equal') @image_comparison(['pie_ccw_true.png']) def test_pie_ccw_true(): # The slices will be ordered and plotted counter-clockwise.
63
64
186
32
31
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_pie_ccw_true
test_pie_ccw_true
5,054
5,066
5,054
5,056
0b020a296a134344da6d8f4ffeb507a2058a8198
bigcode/the-stack
train
28939f164d8fd7e397c8d48b
train
function
def test_tick_label_update(): # test issue 9397 fig, ax = plt.subplots() # Set up a dummy formatter def formatter_func(x, pos): return "unit value" if x == 1 else "" ax.xaxis.set_major_formatter(plt.FuncFormatter(formatter_func)) # Force some of the x-axis ticks to be outsid...
def test_tick_label_update(): # test issue 9397
fig, ax = plt.subplots() # Set up a dummy formatter def formatter_func(x, pos): return "unit value" if x == 1 else "" ax.xaxis.set_major_formatter(plt.FuncFormatter(formatter_func)) # Force some of the x-axis ticks to be outside of the drawn range ax.set_xticks([-1, 0, 1, 2, 3]...
plt.plot([0, 1, 2], [0, -1, 4]) plt.setp(ax.get_yticklabels(), visible=False) ax.tick_params(axis="y", which="both", length=0) def test_tick_label_update(): # test issue 9397
64
64
160
14
50
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_tick_label_update
test_tick_label_update
5,247
5,263
5,247
5,249
0e0c57d5591ed90fc04e933a68313c54803e575f
bigcode/the-stack
train
7d7a18ed79460cbc3bad0fa1
train
function
def test_zero_linewidth(): # Check that setting a zero linewidth doesn't error plt.plot([0, 1], [0, 1], ls='--', lw=0)
def test_zero_linewidth(): # Check that setting a zero linewidth doesn't error
plt.plot([0, 1], [0, 1], ls='--', lw=0)
2.axvspan(1, 2) ax2.plot([0, 0.5], [1, 2]) assert_array_equal(xtwin.viewLim.intervalx, ax2.viewLim.intervalx) def test_zero_linewidth(): # Check that setting a zero linewidth doesn't error
64
64
40
17
47
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_zero_linewidth
test_zero_linewidth
6,241
6,243
6,241
6,242
870b636b65ff0d9148cc2797cf0b9d3a3b2dd93e
bigcode/the-stack
train
8e85b907b56d614d7a7ae2af
train
function
def test_scatter_series_non_zero_index(pd): # create non-zero index ids = range(10, 18) x = pd.Series(np.random.uniform(size=8), index=ids) y = pd.Series(np.random.uniform(size=8), index=ids) c = pd.Series([1, 1, 1, 1, 1, 0, 0, 0], index=ids) plt.scatter(x, y, c)
def test_scatter_series_non_zero_index(pd): # create non-zero index
ids = range(10, 18) x = pd.Series(np.random.uniform(size=8), index=ids) y = pd.Series(np.random.uniform(size=8), index=ids) c = pd.Series([1, 1, 1, 1, 1, 0, 0, 0], index=ids) plt.scatter(x, y, c)
remove_ticks_and_titles(fig) ax.text(np.NaN, 1, 'Boo') renderer = fig.canvas.get_renderer() np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 496) def test_scatter_series_non_zero_index(pd): # create non-zero index
64
64
101
17
47
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_scatter_series_non_zero_index
test_scatter_series_non_zero_index
6,403
6,409
6,403
6,404
f20825c78456bdce6c3d6ccb85f15cc6ecfbb071
bigcode/the-stack
train
0ee96763279ba5a6df503b23
train
function
def test_hist_datetime_datasets(): data = [[datetime.datetime(2017, 1, 1), datetime.datetime(2017, 1, 1)], [datetime.datetime(2017, 1, 1), datetime.datetime(2017, 1, 2)]] fig, ax = plt.subplots() ax.hist(data, stacked=True) ax.hist(data, stacked=False)
def test_hist_datetime_datasets():
data = [[datetime.datetime(2017, 1, 1), datetime.datetime(2017, 1, 1)], [datetime.datetime(2017, 1, 1), datetime.datetime(2017, 1, 2)]] fig, ax = plt.subplots() ax.hist(data, stacked=True) ax.hist(data, stacked=False)
1, 5] mpl_heights, _, _ = plt.hist(t, bins=bins, density=True) np_heights, _ = np.histogram(t, bins=bins, density=True) assert_allclose(mpl_heights, np_heights) def test_hist_datetime_datasets():
64
64
87
7
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hist_datetime_datasets
test_hist_datetime_datasets
1,822
1,827
1,822
1,822
827c3121e1a0350a8f39bee0882c71e35b9100d8
bigcode/the-stack
train
d7d32a42ef01fb0aebc2baf9
train
function
@image_comparison(['fill_between_interpolate_decreasing'], style='mpl20', remove_text=True) def test_fill_between_interpolate_decreasing(): p = np.array([724.3, 700, 655]) t = np.array([9.4, 7, 2.2]) prof = np.array([7.9, 6.6, 3.8]) fig, ax = plt.subplots(figsize=(9, 9)) ...
@image_comparison(['fill_between_interpolate_decreasing'], style='mpl20', remove_text=True) def test_fill_between_interpolate_decreasing():
p = np.array([724.3, 700, 655]) t = np.array([9.4, 7, 2.2]) prof = np.array([7.9, 6.6, 3.8]) fig, ax = plt.subplots(figsize=(9, 9)) ax.plot(t, p, 'tab:red') ax.plot(prof, p, 'k') ax.fill_betweenx(p, t, prof, where=prof < t, facecolor='blue', interpolate=True...
interpolate=True) ax2.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True) @image_comparison(['fill_between_interpolate_decreasing'], style='mpl20', remove_text=True) def test_fill_between_interpolate_decreasing():
64
64
205
31
33
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_fill_between_interpolate_decreasing
test_fill_between_interpolate_decreasing
977
995
977
979
60ad04dccc733eafa3bdccfeb5905852d5b2009e
bigcode/the-stack
train
ea9e4d43b6197edb903f8b50
train
function
def test_bar_label_location_vertical(): ax = plt.gca() xs, heights = [1, 2], [3, -4] rects = ax.bar(xs, heights) labels = ax.bar_label(rects) assert labels[0].xy == (xs[0], heights[0]) assert labels[0].get_ha() == 'center' assert labels[0].get_va() == 'bottom' assert labels[1].xy...
def test_bar_label_location_vertical():
ax = plt.gca() xs, heights = [1, 2], [3, -4] rects = ax.bar(xs, heights) labels = ax.bar_label(rects) assert labels[0].xy == (xs[0], heights[0]) assert labels[0].get_ha() == 'center' assert labels[0].get_va() == 'bottom' assert labels[1].xy == (xs[1], heights[1]) assert label...
ha_with_position(ha): fig = Figure() ax = fig.subplots() ax.set_ylabel("test", y=1, ha=ha) ax.yaxis.set_label_position("right") assert ax.yaxis.get_label().get_ha() == ha def test_bar_label_location_vertical():
64
64
138
7
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bar_label_location_vertical
test_bar_label_location_vertical
7,069
7,079
7,069
7,069
d14e8faa787da6d0f8a91feea972945a4aaf465b
bigcode/the-stack
train
586383226007a8def00e0f65
train
function
@image_comparison(['hexbin_log.png'], style='mpl20') def test_hexbin_log(): # Issue #1636 (and also test log scaled colorbar) # Remove this line when this test image is regenerated. plt.rcParams['pcolormesh.snap'] = False np.random.seed(19680801) n = 100000 x = np.random.standard_norm...
@image_comparison(['hexbin_log.png'], style='mpl20') def test_hexbin_log(): # Issue #1636 (and also test log scaled colorbar) # Remove this line when this test image is regenerated.
plt.rcParams['pcolormesh.snap'] = False np.random.seed(19680801) n = 100000 x = np.random.standard_normal(n) y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n) y = np.power(2, y * 0.5) fig, ax = plt.subplots() h = ax.hexbin(x, y, yscale='log', bins='log', ...
400, y=300) assert hb.contains(mouse_event)[0] @image_comparison(['hexbin_log.png'], style='mpl20') def test_hexbin_log(): # Issue #1636 (and also test log scaled colorbar) # Remove this line when this test image is regenerated.
63
64
172
48
15
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hexbin_log
test_hexbin_log
770
786
770
774
c8233c2d3699e484b7a45b007bf740338fa41a89
bigcode/the-stack
train
a73aa5c672f42eaef552180e
train
function
def _bxp_test_helper( stats_kwargs={}, transform_stats=lambda s: s, bxp_kwargs={}): np.random.seed(937) logstats = mpl.cbook.boxplot_stats( np.random.lognormal(mean=1.25, sigma=1., size=(37, 4)), **stats_kwargs) fig, ax = plt.subplots() if bxp_kwargs.get('vert', True): ax....
def _bxp_test_helper( stats_kwargs={}, transform_stats=lambda s: s, bxp_kwargs={}):
np.random.seed(937) logstats = mpl.cbook.boxplot_stats( np.random.lognormal(mean=1.25, sigma=1., size=(37, 4)), **stats_kwargs) fig, ax = plt.subplots() if bxp_kwargs.get('vert', True): ax.set_yscale('log') else: ax.set_xscale('log') # Work around baseline images ...
0].stackplot(range(100), d.T, baseline='wiggle') axs[1, 1].stackplot(range(100), d.T, baseline='weighted_wiggle') def _bxp_test_helper( stats_kwargs={}, transform_stats=lambda s: s, bxp_kwargs={}):
63
64
188
23
40
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
_bxp_test_helper
_bxp_test_helper
2,594
2,609
2,594
2,595
05b34fbf72eb776ced8fc60e19cb49652cf2837f
bigcode/the-stack
train
5f194592285c5ddc4d3ea32c
train
function
@image_comparison(['violinplot_vert_showextrema.png']) def test_vert_violinplot_showextrema(): ax = plt.axes() # First 9 digits of frac(sqrt(5)) np.random.seed(236067977) data = [np.random.normal(size=100) for _ in range(4)] ax.violinplot(data, positions=range(4), showmeans=0, showextrema=1, ...
@image_comparison(['violinplot_vert_showextrema.png']) def test_vert_violinplot_showextrema():
ax = plt.axes() # First 9 digits of frac(sqrt(5)) np.random.seed(236067977) data = [np.random.normal(size=100) for _ in range(4)] ax.violinplot(data, positions=range(4), showmeans=0, showextrema=1, showmedians=0)
100) for _ in range(4)] ax.violinplot(data, positions=range(4), showmeans=1, showextrema=0, showmedians=0) @image_comparison(['violinplot_vert_showextrema.png']) def test_vert_violinplot_showextrema():
64
64
101
24
40
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_vert_violinplot_showextrema
test_vert_violinplot_showextrema
3,082
3,089
3,082
3,083
edf019972127b955011052becf56f8f69cee6f96
bigcode/the-stack
train
6a81531f4eac1c724def0ef5
train
function
def test_barb_units(): fig, ax = plt.subplots() dates = [datetime.datetime(2017, 7, 15, 18, i) for i in range(0, 60, 10)] y = np.linspace(0, 5, len(dates)) u = v = np.linspace(0, 50, len(dates)) ax.barbs(dates, y, u, v)
def test_barb_units():
fig, ax = plt.subplots() dates = [datetime.datetime(2017, 7, 15, 18, i) for i in range(0, 60, 10)] y = np.linspace(0, 5, len(dates)) u = v = np.linspace(0, 50, len(dates)) ax.barbs(dates, y, u, v)
2On=False) assert not ax.yaxis.get_offset_text().get_visible() def test_large_offset(): fig, ax = plt.subplots() ax.plot((1 + np.array([0, 1.e-12])) * 1.e27) fig.canvas.draw() def test_barb_units():
64
64
93
6
58
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_barb_units
test_barb_units
6,088
6,093
6,088
6,088
a0f765cf96ec39159b74ddc5751ce1f1ccb7a324
bigcode/the-stack
train
72c371c880297f1c10f01823
train
function
def test_log_scales_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_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)
ax = plt.subplots() ax.plot(np.log(np.linspace(0.1, 100))) ax.set_yscale('log', base=5.5) ax.invert_yaxis() ax.set_xscale('log', base=9.0) def test_log_scales_no_data():
64
64
61
8
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_log_scales_no_data
test_log_scales_no_data
2,532
2,536
2,532
2,532
17f04fd6cf517d46650cde5ae242cd6c13309731
bigcode/the-stack
train
994ccebe8ab346de0128793e
train
function
@image_comparison(['set_get_ticklabels.png']) def test_set_get_ticklabels(): # test issue 2246 fig, ax = plt.subplots(2) ha = ['normal', 'set_x/yticklabels'] ax[0].plot(np.arange(10)) ax[0].set_title(ha[0]) ax[1].plot(np.arange(10)) ax[1].set_title(ha[1]) # set ticklabel t...
@image_comparison(['set_get_ticklabels.png']) def test_set_get_ticklabels(): # test issue 2246
fig, ax = plt.subplots(2) ha = ['normal', 'set_x/yticklabels'] ax[0].plot(np.arange(10)) ax[0].set_title(ha[0]) ax[1].plot(np.arange(10)) ax[1].set_title(ha[1]) # set ticklabel to 1 plot in normal way ax[0].set_xticks(range(10)) ax[0].set_yticks(range(10)) ax[0].se...
) assert abs(t1[0][-1].theta2 - 360.) < 1e-3 t2 = ax.pie(x=x, normalize=False) assert abs(t2[0][-1].theta2 - 360.) > 1e-3 @image_comparison(['set_get_ticklabels.png']) def test_set_get_ticklabels(): # test issue 2246
86
86
289
26
59
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_set_get_ticklabels
test_set_get_ticklabels
5,163
5,186
5,163
5,165
da555fc3fce2f98458e8979e7d270a020abe5acf
bigcode/the-stack
train
b37e23969177c73a523210b2
train
function
def test_bar_label_location_center(): ax = plt.gca() ys, widths = [1, 2], [3, -4] rects = ax.barh(ys, widths) labels = ax.bar_label(rects, label_type='center') assert labels[0].xy == (widths[0] / 2, ys[0]) assert labels[0].get_ha() == 'center' assert labels[0].get_va() == 'center' ...
def test_bar_label_location_center():
ax = plt.gca() ys, widths = [1, 2], [3, -4] rects = ax.barh(ys, widths) labels = ax.bar_label(rects, label_type='center') assert labels[0].xy == (widths[0] / 2, ys[0]) assert labels[0].get_ha() == 'center' assert labels[0].get_va() == 'center' assert labels[1].xy == (widths[1] / 2...
labels[0].get_va() == 'center' assert labels[1].xy == (widths[1], ys[1]) assert labels[1].get_ha() == 'right' assert labels[1].get_va() == 'center' def test_bar_label_location_center():
63
64
155
7
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bar_label_location_center
test_bar_label_location_center
7,095
7,105
7,095
7,095
097796e221efdc2903823ff0f09d2860cc514ec4
bigcode/the-stack
train
c3f92961eebced8b851cb03f
train
function
def test_vlines_default(): fig, ax = plt.subplots() with mpl.rc_context({'lines.color': 'red'}): lines = ax.vlines(0.5, 0, 1) assert mpl.colors.same_color(lines.get_color(), 'red')
def test_vlines_default():
fig, ax = plt.subplots() with mpl.rc_context({'lines.color': 'red'}): lines = ax.vlines(0.5, 0, 1) assert mpl.colors.same_color(lines.get_color(), 'red')
.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():
64
64
57
6
58
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_vlines_default
test_vlines_default
4,328
4,332
4,328
4,328
93797b1c34e1cc9f1ccd36a6c6fceb06ce20958d
bigcode/the-stack
train
f91e852445ba139039211296
train
function
def test_spines_properbbox_after_zoom(): fig, ax = plt.subplots() bb = ax.spines.bottom.get_window_extent(fig.canvas.get_renderer()) # this is what zoom calls: ax._set_view_from_bbox((320, 320, 500, 500), 'in', None, False, False) bb2 = ax.spines.bottom.get_window_ex...
def test_spines_properbbox_after_zoom():
fig, ax = plt.subplots() bb = ax.spines.bottom.get_window_extent(fig.canvas.get_renderer()) # this is what zoom calls: ax._set_view_from_bbox((320, 320, 500, 500), 'in', None, False, False) bb2 = ax.spines.bottom.get_window_extent(fig.canvas.get_renderer()) np.te...
) ax.set_aspect(3.) ax.set_position([0.1, 0.1, 0.4, 0.4], which='active') assert np.allclose(ax.get_position().width, 0.1) def test_spines_properbbox_after_zoom():
64
64
109
10
54
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_spines_properbbox_after_zoom
test_spines_properbbox_after_zoom
6,385
6,392
6,385
6,385
1c263df50ebb4b0f1b8ec3aa761744e1bbae2bc1
bigcode/the-stack
train
b914392a3e5eba9e4965e9da
train
function
def test_text_labelsize(): """ tests for issue #1172 """ fig = plt.figure() ax = fig.gca() ax.tick_params(labelsize='large') ax.tick_params(direction='out')
def test_text_labelsize():
""" tests for issue #1172 """ fig = plt.figure() ax = fig.gca() ax.tick_params(labelsize='large') ax.tick_params(direction='out')
(False) assert ax.get_xlim() == x2 assert ax.get_ylim() == y2 ax.relim(visible_only=True) ax.autoscale_view() assert ax.get_xlim() == x1 assert ax.get_ylim() == y1 def test_text_labelsize():
64
64
48
6
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_text_labelsize
test_text_labelsize
4,964
4,971
4,964
4,964
d72acc07ee0f13c768a9ae9c40a3914c504122b8
bigcode/the-stack
train
a0cc74b31c18677f8f18f72b
train
function
@mpl.style.context('default') def test_autoscale_log_shared(): # related to github #7587 # array starts at zero to trigger _minpos handling x = np.arange(100, dtype=float) fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) ax1.loglog(x, x) ax2.semilogx(x, x) ax1.autoscale(tight=True) ...
@mpl.style.context('default') def test_autoscale_log_shared(): # related to github #7587 # array starts at zero to trigger _minpos handling
x = np.arange(100, dtype=float) fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) ax1.loglog(x, x) ax2.semilogx(x, x) ax1.autoscale(tight=True) ax2.autoscale(tight=True) plt.draw() lims = (x[1], x[-1]) assert_allclose(ax1.get_xlim(), lims) assert_allclose(ax1.get_ylim(),...
.15, 3.15)) assert_allclose(ax.get_ylim(), (1.0, 4.0)) @mpl.style.context('default') def test_autoscale_log_shared(): # related to github #7587 # array starts at zero to trigger _minpos handling
63
64
182
37
26
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_autoscale_log_shared
test_autoscale_log_shared
470
485
470
473
37f0d5e71a2ce3c2b8448e3f7c58a35bc214b1cb
bigcode/the-stack
train
4802e079a28a2b484519cfdb
train
function
def test_marker_as_markerstyle(): fix, ax = plt.subplots() m = mmarkers.MarkerStyle('o') ax.plot([1, 2, 3], [3, 2, 1], marker=m) ax.scatter([1, 2, 3], [4, 3, 2], marker=m) ax.errorbar([1, 2, 3], [5, 4, 3], marker=m)
def test_marker_as_markerstyle():
fix, ax = plt.subplots() m = mmarkers.MarkerStyle('o') ax.plot([1, 2, 3], [3, 2, 1], marker=m) ax.scatter([1, 2, 3], [4, 3, 2], marker=m) ax.errorbar([1, 2, 3], [5, 4, 3], marker=m)
='green', edgecolor='green', zorder=1) e2 = mpatches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e2) def test_marker_as_markerstyle():
64
64
98
7
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_marker_as_markerstyle
test_marker_as_markerstyle
1,348
1,353
1,348
1,348
9652ba03c2a2d1bfadd644b33a1ef6c4287917f7
bigcode/the-stack
train
a751293226f1aa6a2cdb5c42
train
function
@check_figures_equal() def test_errorbar_every(fig_test, fig_ref): x = np.linspace(0, 1, 15) y = x * (1-x) yerr = y/6 ax_ref = fig_ref.subplots() ax_test = fig_test.subplots() for color, shift in zip('rgbk', [0, 0, 2, 7]): y += .02 # Check errorevery using an expli...
@check_figures_equal() def test_errorbar_every(fig_test, fig_ref):
x = np.linspace(0, 1, 15) y = x * (1-x) yerr = y/6 ax_ref = fig_ref.subplots() ax_test = fig_test.subplots() for color, shift in zip('rgbk', [0, 0, 2, 7]): y += .02 # Check errorevery using an explicit offset and step. ax_test.errorbar(x, y, yerr, errorevery...
, 15) y = x * (1-x) yerr = y/6 ax = plt.figure().subplots() with pytest.raises(ValueError, match='not a tuple of two integers'): ax.errorbar(x, y, yerr, errorevery=(1, 2, 3)) with pytest.raises(ValueError, match='not a tuple of two integers'): ax.errorbar(x, y, yerr, error...
191
192
641
17
174
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_errorbar_every
test_errorbar_every
3,517
3,558
3,517
3,518
da7aea288426e2d2e7a621f598836b49bbc6658d
bigcode/the-stack
train
3304b5b95a78422b3cd2431f
train
function
def test_stairs_invalid_nan(): with pytest.raises(ValueError, match='Nan values in "edges"'): plt.stairs([1, 2], [0, np.nan, 1])
def test_stairs_invalid_nan():
with pytest.raises(ValueError, match='Nan values in "edges"'): plt.stairs([1, 2], [0, np.nan, 1])
0, None) def test_stairs_empty(): ax = plt.figure().add_subplot() ax.stairs([], [42]) assert ax.get_xlim() == (39, 45) assert ax.get_ylim() == (-0.06, 0.06) def test_stairs_invalid_nan():
64
64
42
7
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_stairs_invalid_nan
test_stairs_invalid_nan
1,993
1,995
1,993
1,993
d7334d826a2855f68804d7ac2c54960bd12044af
bigcode/the-stack
train
318063d1ad7b5eebd2116d3f
train
function
def test_imshow_norm_vminvmax(): """Parameters vmin, vmax should error if norm is given.""" a = [[1, 2], [3, 4]] ax = plt.axes() with pytest.raises(ValueError, match="Passing parameters norm and vmin/vmax " "simultaneously is not supported."): ...
def test_imshow_norm_vminvmax():
"""Parameters vmin, vmax should error if norm is given.""" a = [[1, 2], [3, 4]] ax = plt.axes() with pytest.raises(ValueError, match="Passing parameters norm and vmin/vmax " "simultaneously is not supported."): ax.imshow(a, norm=mcolors.N...
_path = x.get_paths()[0] clip_transform = x.get_transform() clip_path = mtransforms.TransformedPath(clip_path, clip_transform) # Plot the image clipped by the contour ax.imshow(r, clip_path=clip_path) def test_imshow_norm_vminvmax():
64
64
99
10
54
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_imshow_norm_vminvmax
test_imshow_norm_vminvmax
898
905
898
898
7df3f7303fc4001d63228621a5df6151ef5da6b8
bigcode/the-stack
train
801151ee8406f459349f8649
train
function
def test_shared_axes_autoscale(): l = np.arange(-80, 90, 40) t = np.random.random_sample((l.size, l.size)) fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True, sharey=True) ax1.set_xlim(-1000, 1000) ax1.set_ylim(-1000, 1000) ax1.contour(l, l, t) ax2.contour(l, l, t) assert not...
def test_shared_axes_autoscale():
l = np.arange(-80, 90, 40) t = np.random.random_sample((l.size, l.size)) fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True, sharey=True) ax1.set_xlim(-1000, 1000) ax1.set_ylim(-1000, 1000) ax1.contour(l, l, t) ax2.contour(l, l, t) assert not ax1.get_autoscalex_on() and not ax...
') ax = ax_lst[0][0] orig_xlim = ax_lst[0][1].get_xlim() ax.remove() ax.set_xlim(0, 5) assert_array_equal(ax_lst[0][1].get_xlim(), orig_xlim) def test_shared_axes_autoscale():
64
64
201
8
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_shared_axes_autoscale
test_shared_axes_autoscale
5,733
5,747
5,733
5,733
7559584e808a8cac05a150bfff125fb3025f9ee1
bigcode/the-stack
train
e8aa64f87101a4b523478557
train
function
@pytest.mark.parametrize('elinewidth', [[1, 2, 3], np.array([1, 2, 3]), 1]) def test_errorbar_linewidth_type(elinewidth): plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth)
@pytest.mark.parametrize('elinewidth', [[1, 2, 3], np.array([1, 2, 3]), 1]) def test_errorbar_linewidth_type(elinewidth):
plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth)
1::3], capsize=4, c='C1', fmt='none') @pytest.mark.parametrize('elinewidth', [[1, 2, 3], np.array([1, 2, 3]), 1]) def test_errorbar_linewidth_type(elinewidth):
63
64
84
44
19
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_errorbar_linewidth_type
test_errorbar_linewidth_type
3,561
3,565
3,561
3,564
94e764f21f12c70a63b53ce0fb49b37377c40b15
bigcode/the-stack
train
b560210e8f109c409f182d7f
train
function
@image_comparison(["dash_offset"], remove_text=True) def test_dash_offset(): fig, ax = plt.subplots() x = np.linspace(0, 10) y = np.ones_like(x) for j in range(0, 100, 2): ax.plot(x, j*y, ls=(j, (10, 10)), lw=5, color='k')
@image_comparison(["dash_offset"], remove_text=True) def test_dash_offset():
fig, ax = plt.subplots() x = np.linspace(0, 10) y = np.ones_like(x) for j in range(0, 100, 2): ax.plot(x, j*y, ls=(j, (10, 10)), lw=5, color='k')
_err, *empty] @pytest.mark.parametrize('kwargs', generate_errorbar_inputs()) def test_errorbar_inputs_shotgun(kwargs): ax = plt.gca() eb = ax.errorbar(**kwargs) eb.remove() @image_comparison(["dash_offset"], remove_text=True) def test_dash_offset():
64
64
84
17
47
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_dash_offset
test_dash_offset
5,574
5,580
5,574
5,575
0590165ca223d73d9dca89b7862a43af9fc93a7d
bigcode/the-stack
train
f6cfe20de1b9ace633b65fba
train
function
def test_bbox_aspect_axes_init(): # Test that box_aspect can be given to axes init and produces # all equal square axes. fig, axs = plt.subplots(2, 3, subplot_kw=dict(box_aspect=1), constrained_layout=True) fig.canvas.draw() renderer = fig.canvas.get_renderer() ...
def test_bbox_aspect_axes_init(): # Test that box_aspect can be given to axes init and produces # all equal square axes.
fig, axs = plt.subplots(2, 3, subplot_kw=dict(box_aspect=1), constrained_layout=True) fig.canvas.draw() renderer = fig.canvas.get_renderer() sizes = [] for ax in axs.flat: bb = ax.get_window_extent(renderer) sizes.extend([bb.width, bb.height]) ...
() bb1 = ax1.get_position() bb2 = ax2.get_position() assert_array_equal(bb1.extents, bb2.extents) def test_bbox_aspect_axes_init(): # Test that box_aspect can be given to axes init and produces # all equal square axes.
64
64
112
31
33
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bbox_aspect_axes_init
test_bbox_aspect_axes_init
6,877
6,889
6,877
6,879
a3debaec2d9d954eabb2caa149aa14c39b3d3166
bigcode/the-stack
train
1c65baba05158359bccb8b1e
train
function
def test_bar_pandas(pd): # Smoke test for pandas df = pd.DataFrame( {'year': [2018, 2018, 2018], 'month': [1, 1, 1], 'day': [1, 2, 3], 'value': [1, 2, 3]}) df['date'] = pd.to_datetime(df[['year', 'month', 'day']]) monthly = df[['date', 'value']].groupby(['dat...
def test_bar_pandas(pd): # Smoke test for pandas
df = pd.DataFrame( {'year': [2018, 2018, 2018], 'month': [1, 1, 1], 'day': [1, 2, 3], 'value': [1, 2, 3]}) df['date'] = pd.to_datetime(df[['year', 'month', 'day']]) monthly = df[['date', 'value']].groupby(['date']).sum() dates = monthly.index forecast = m...
: register_matplotlib_converters() im = ax.pcolormesh(time_axis, y_axis, z_data) # make sure this does not raise! fig.canvas.draw() finally: deregister_matplotlib_converters() def test_bar_pandas(pd): # Smoke test for pandas
64
64
176
14
50
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bar_pandas
test_bar_pandas
1,685
1,701
1,685
1,686
c8747523abce7cb712329935bebb5f54b887dffd
bigcode/the-stack
train
f7866d33e053f2703c4f021f
train
function
@image_comparison(['bxp_custompositions.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]))
@image_comparison(['bxp_custompositions.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]))
_kwargs=dict(widths=[0.10, 0.25, 0.65, 0.85])) @image_comparison(['bxp_custompositions.png'], remove_text=True, savefig_kwarg={'dpi': 40}, style='default') def test_bxp_custompositions():
63
64
63
39
24
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bxp_custompositions
test_bxp_custompositions
2,811
2,816
2,811
2,815
34209d7b65470b8f6cea32ee119d52d13b42bea5
bigcode/the-stack
train
e1746d0128b2be39529f351a
train
function
@check_figures_equal(extensions=["png"]) def test_plot_decimal(fig_test, fig_ref): x0 = np.arange(-10, 10, 0.3) y0 = [5.2 * x ** 3 - 2.1 * x ** 2 + 7.34 * x + 4.5 for x in x0] x = [Decimal(i) for i in x0] y = [Decimal(i) for i in y0] # Test image - line plot with Decimal input fig_test.su...
@check_figures_equal(extensions=["png"]) def test_plot_decimal(fig_test, fig_ref):
x0 = np.arange(-10, 10, 0.3) y0 = [5.2 * x ** 3 - 2.1 * x ** 2 + 7.34 * x + 4.5 for x in x0] x = [Decimal(i) for i in x0] y = [Decimal(i) for i in y0] # Test image - line plot with Decimal input fig_test.subplots().plot(x, y) # Reference image fig_ref.subplots().plot(x0, y0)
_legend(): fig, ax = plt.subplots() ax.errorbar([], [], xerr=[], label='empty y') ax.errorbar([], [], yerr=[], label='empty x') ax.legend() @check_figures_equal(extensions=["png"]) def test_plot_decimal(fig_test, fig_ref):
64
64
143
21
43
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_plot_decimal
test_plot_decimal
6,253
6,262
6,253
6,254
c054156a41a445bb2cc68a6ba93f200a16de49d0
bigcode/the-stack
train
6d2d68d1d75389e29387340f
train
function
@pytest.mark.parametrize('twin', ('x', 'y')) @check_figures_equal(extensions=['png'], tol=0.19) def test_twin_logscale(fig_test, fig_ref, twin): twin_func = f'twin{twin}' # test twinx or twiny set_scale = f'set_{twin}scale' x = np.arange(1, 100) # Change scale after twinning. ax_test = fig...
@pytest.mark.parametrize('twin', ('x', 'y')) @check_figures_equal(extensions=['png'], tol=0.19) def test_twin_logscale(fig_test, fig_ref, twin):
twin_func = f'twin{twin}' # test twinx or twiny set_scale = f'set_{twin}scale' x = np.arange(1, 100) # Change scale after twinning. ax_test = fig_test.add_subplot(2, 1, 1) ax_twin = getattr(ax_test, twin_func)() getattr(ax_test, set_scale)('log') ax_twin.plot(x, x) # Twi...
3.cla() assert not ax2.xaxis.get_visible() assert not ax2.patch.get_visible() assert ax2.yaxis.get_visible() assert ax3.xaxis.get_visible() assert not ax3.patch.get_visible() assert not ax3.yaxis.get_visible() assert ax.xaxis.get_visible() assert ax.patch.get_visible() ...
126
126
423
43
83
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_twin_logscale
test_twin_logscale
311
352
311
313
00d492c5fb6d133a867dc36baf16241b607770e1
bigcode/the-stack
train
87c52da6c23e3dfa0afab9bd
train
function
@image_comparison(['bxp_customoutlier.png'], remove_text=True, savefig_kwarg={'dpi': 40}, style='default') def test_bxp_customoutlier(): _bxp_test_helper(bxp_kwargs=dict( flierprops=dict(linestyle='none', marker='d', mfc='g')))
@image_comparison(['bxp_customoutlier.png'], remove_text=True, savefig_kwarg={'dpi': 40}, style='default') def test_bxp_customoutlier():
_bxp_test_helper(bxp_kwargs=dict( flierprops=dict(linestyle='none', marker='d', mfc='g')))
patch_artist=True, boxprops=dict(facecolor='yellow', edgecolor='green', ls=':'))) @image_comparison(['bxp_customoutlier.png'], remove_text=True, savefig_kwarg={'dpi': 40}, style='default') def test_bxp_customoutlier():
63
64
73
41
22
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bxp_customoutlier
test_bxp_customoutlier
2,685
2,691
2,685
2,689
3825ba8e67e05b4eef57a153320e1f14756f91d5
bigcode/the-stack
train
ce4503a53f77a5bc79001c67
train
function
@image_comparison(['boxplot_sym2.png'], remove_text=True, style='default') def test_boxplot_sym2(): # Randomness used for bootstrapping. np.random.seed(937) x = np.linspace(-7, 7, 140) x = np.hstack([-25, x, 25]) fig, [ax1, ax2] = plt.subplots(1, 2) ax1.boxplot([x, x], bootstrap=10000...
@image_comparison(['boxplot_sym2.png'], remove_text=True, style='default') def test_boxplot_sym2(): # Randomness used for bootstrapping.
np.random.seed(937) x = np.linspace(-7, 7, 140) x = np.hstack([-25, x, 25]) fig, [ax1, ax2] = plt.subplots(1, 2) ax1.boxplot([x, x], bootstrap=10000, sym='^') ax1.set_ylim((-30, 30)) ax2.boxplot([x, x], bootstrap=10000, sym='g') ax2.set_ylim((-30, 30))
.boxplot("x", bootstrap=10000, notch=1, data=data) ax.set_ylim((-30, 30)) @image_comparison(['boxplot_sym2.png'], remove_text=True, style='default') def test_boxplot_sym2(): # Randomness used for bootstrapping.
63
64
150
36
27
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_boxplot_sym2
test_boxplot_sym2
2,848
2,861
2,848
2,850
d42e478d8fdd4ed80b3ba76ebe0cc79aa0268404
bigcode/the-stack
train
5949fb65a755953655624c66
train
function
@image_comparison(['hexbin_extent.png', 'hexbin_extent.png'], remove_text=True) def test_hexbin_extent(): # this test exposes sf bug 2856228 fig, ax = plt.subplots() data = (np.arange(2000) / 2000).reshape((2, 1000)) x, y = data ax.hexbin(x, y, extent=[.1, .3, .6, .7]) # Reuse testcas...
@image_comparison(['hexbin_extent.png', 'hexbin_extent.png'], remove_text=True) def test_hexbin_extent(): # this test exposes sf bug 2856228
fig, ax = plt.subplots() data = (np.arange(2000) / 2000).reshape((2, 1000)) x, y = data ax.hexbin(x, y, extent=[.1, .3, .6, .7]) # Reuse testcase from above for a labeled data test data = {"x": x, "y": y} fig, ax = plt.subplots() ax.hexbin("x", "y", extent=[.1, .3, .6, .7], ...
.25) ax.set_ylim(t0 - 5.0*dt, tf + 5.0*dt) @image_comparison(['hexbin_extent.png', 'hexbin_extent.png'], remove_text=True) def test_hexbin_extent(): # this test exposes sf bug 2856228
64
64
159
38
26
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hexbin_extent
test_hexbin_extent
737
750
737
739
919e88c018f250bfb6fd56e647dbbed290c10471
bigcode/the-stack
train
cbce7c43555205878cb2248d
train
function
@pytest.mark.parametrize('kwargs', generate_errorbar_inputs()) def test_errorbar_inputs_shotgun(kwargs): ax = plt.gca() eb = ax.errorbar(**kwargs) eb.remove()
@pytest.mark.parametrize('kwargs', generate_errorbar_inputs()) def test_errorbar_inputs_shotgun(kwargs):
ax = plt.gca() eb = ax.errorbar(**kwargs) eb.remove()
yerr_cy both_err = base_xy * yerr_cy * xerr_cy return [*xerr_only, *yerr_only, *both_err, *empty] @pytest.mark.parametrize('kwargs', generate_errorbar_inputs()) def test_errorbar_inputs_shotgun(kwargs):
63
64
41
21
42
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_errorbar_inputs_shotgun
test_errorbar_inputs_shotgun
5,567
5,571
5,567
5,568
138b0ad3c9f3984a5f4399d92aa7c55b714becda
bigcode/the-stack
train
0ed810c667d46163bc6babe0
train
function
@check_figures_equal(extensions=["png"]) def test_sticky_shared_axes(fig_test, fig_ref): # Check that sticky edges work whether they are set in an axes that is a # "master" in a share, or an axes that is a "follower". Z = np.arange(15).reshape(3, 5) ax0 = fig_test.add_subplot(211) ax1 = fig_...
@check_figures_equal(extensions=["png"]) def test_sticky_shared_axes(fig_test, fig_ref): # Check that sticky edges work whether they are set in an axes that is a # "master" in a share, or an axes that is a "follower".
Z = np.arange(15).reshape(3, 5) ax0 = fig_test.add_subplot(211) ax1 = fig_test.add_subplot(212, sharex=ax0) ax1.pcolormesh(Z) ax0 = fig_ref.add_subplot(212) ax1 = fig_ref.add_subplot(211, sharex=ax0) ax0.pcolormesh(Z)
5)) @check_figures_equal(extensions=["png"]) def test_sticky_shared_axes(fig_test, fig_ref): # Check that sticky edges work whether they are set in an axes that is a # "master" in a share, or an axes that is a "follower".
63
64
148
61
2
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_sticky_shared_axes
test_sticky_shared_axes
507
519
507
510
7e81f0f9d28e5db230dc052d39a0c7a6c4212a8a
bigcode/the-stack
train
48a465b2a197eca76b0548e0
train
function
@image_comparison(['single_date.png'], style='mpl20') def test_single_date(): # use former defaults to match existing baseline image plt.rcParams['axes.formatter.limits'] = -7, 7 dt = mdates.date2num(np.datetime64('0000-12-31')) time1 = [721964.0] data1 = [-65.54] fig, ax = plt.subp...
@image_comparison(['single_date.png'], style='mpl20') def test_single_date(): # use former defaults to match existing baseline image
plt.rcParams['axes.formatter.limits'] = -7, 7 dt = mdates.date2num(np.datetime64('0000-12-31')) time1 = [721964.0] data1 = [-65.54] fig, ax = plt.subplots(2, 1) ax[0].plot_date(time1 + dt, data1, 'o', color='r') ax[1].plot(time1, data1, 'o', color='r')
) ax1.plot('a', 'a', 'o', data=data) ax2.plot('b', 'b', 'o', data=data) @image_comparison(['single_date.png'], style='mpl20') def test_single_date(): # use former defaults to match existing baseline image
64
64
142
31
33
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_single_date
test_single_date
650
662
650
653
675fb89837514c5d5826276fd90ad3b92a0103f4
bigcode/the-stack
train
58897f07cb463498f1847512
train
function
@image_comparison(['boxplot_autorange_false_whiskers.png', 'boxplot_autorange_true_whiskers.png'], style='default') def test_boxplot_autorange_whiskers(): # Randomness used for bootstrapping. np.random.seed(937) x = np.ones(140) x = np.hstack([0, x, 2]) ...
@image_comparison(['boxplot_autorange_false_whiskers.png', 'boxplot_autorange_true_whiskers.png'], style='default') def test_boxplot_autorange_whiskers(): # Randomness used for bootstrapping.
np.random.seed(937) x = np.ones(140) x = np.hstack([0, x, 2]) fig1, ax1 = plt.subplots() ax1.boxplot([x, x], bootstrap=10000, notch=1) ax1.set_ylim((-5, 5)) fig2, ax2 = plt.subplots() ax2.boxplot([x, x], bootstrap=10000, notch=1, autorange=True) ax2.set_ylim((-5, 5))
') ax.set_ylim((-30, 30)) @image_comparison(['boxplot_autorange_false_whiskers.png', 'boxplot_autorange_true_whiskers.png'], style='default') def test_boxplot_autorange_whiskers(): # Randomness used for bootstrapping.
63
64
165
52
11
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_boxplot_autorange_whiskers
test_boxplot_autorange_whiskers
2,877
2,893
2,877
2,881
0aeffae777162fdf56cfb26734c73320a765dc17
bigcode/the-stack
train
9f56333f768d072ad7c7d339
train
function
def test_spy_invalid_kwargs(): fig, ax = plt.subplots() for unsupported_kw in [{'interpolation': 'nearest'}, {'marker': 'o', 'linestyle': 'solid'}]: with pytest.raises(TypeError): ax.spy(np.eye(3, 3), **unsupported_kw)
def test_spy_invalid_kwargs():
fig, ax = plt.subplots() for unsupported_kw in [{'interpolation': 'nearest'}, {'marker': 'o', 'linestyle': 'solid'}]: with pytest.raises(TypeError): ax.spy(np.eye(3, 3), **unsupported_kw)
10) axs_ref[1].set( aspect=1, xlim=axs_ref[0].get_xlim(), ylim=axs_ref[0].get_ylim()[::-1]) for ax in axs_ref: ax.xaxis.set_ticks_position("both") def test_spy_invalid_kwargs():
63
64
64
7
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_spy_invalid_kwargs
test_spy_invalid_kwargs
148
153
148
148
39b2fd7ecc67a3e5bc8495a028fa371dfbeb0604
bigcode/the-stack
train
ef2778c0d17e661d8323463a
train
function
@pytest.mark.parametrize('axis', ('x', 'y')) @pytest.mark.parametrize('auto', (True, False, None)) def test_unautoscale(axis, auto): fig, ax = plt.subplots() x = np.arange(100) y = np.linspace(-.1, .1, 100) ax.scatter(y, x) get_autoscale_on = getattr(ax, f'get_autoscale{axis}_on') set_...
@pytest.mark.parametrize('axis', ('x', 'y')) @pytest.mark.parametrize('auto', (True, False, None)) def test_unautoscale(axis, auto):
fig, ax = plt.subplots() x = np.arange(100) y = np.linspace(-.1, .1, 100) ax.scatter(y, x) get_autoscale_on = getattr(ax, f'get_autoscale{axis}_on') set_lim = getattr(ax, f'set_{axis}lim') get_lim = getattr(ax, f'get_{axis}lim') post_auto = get_autoscale_on() if auto is None e...
= ax.yaxis.get_major_ticks() for tick in ticks: assert tick.tick1line.get_markeredgecolor() != 'white' @pytest.mark.parametrize('axis', ('x', 'y')) @pytest.mark.parametrize('auto', (True, False, None)) def test_unautoscale(axis, auto):
63
64
190
34
29
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_unautoscale
test_unautoscale
6,923
6,940
6,923
6,925
92482aa9fc426c66d85c4c742a401274d6a872cf
bigcode/the-stack
train
5154782bd0399271d5bc360c
train
function
@image_comparison(['boxplot_sym.png'], remove_text=True, savefig_kwarg={'dpi': 40}, style='default') def test_boxplot_sym(): x = np.linspace(-7, 7, 140) x = np.hstack([-25, x, 25]) fig, ax = plt.subplots() ax.boxplot([x, x], sym='gs') ...
@image_comparison(['boxplot_sym.png'], remove_text=True, savefig_kwarg={'dpi': 40}, style='default') def test_boxplot_sym():
x = np.linspace(-7, 7, 140) x = np.hstack([-25, x, 25]) fig, ax = plt.subplots() ax.boxplot([x, x], sym='gs') ax.set_ylim((-30, 30))
plot([x, x], bootstrap=10000, sym='g') ax2.set_ylim((-30, 30)) @image_comparison(['boxplot_sym.png'], remove_text=True, savefig_kwarg={'dpi': 40}, style='default') def test_boxplot_sym():
63
64
96
37
26
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_boxplot_sym
test_boxplot_sym
2,864
2,874
2,864
2,868
ee7d0d8299740e421b2738123ed7c8650e3cb0f1
bigcode/the-stack
train
68b06058a3a9efe3b18a738c
train
function
def test_pie_textprops(): data = [23, 34, 45] labels = ["Long name 1", "Long name 2", "Long name 3"] textprops = dict(horizontalalignment="center", verticalalignment="top", rotation=90, rotation_mode="anchor", size=...
def test_pie_textprops():
data = [23, 34, 45] labels = ["Long name 1", "Long name 2", "Long name 3"] textprops = dict(horizontalalignment="center", verticalalignment="top", rotation=90, rotation_mode="anchor", size=12, color="red") _, ...
colors=colors, autopct='%1.1f%%', shadow=True, startangle=90, labeldistance=None, rotatelabels=True) plt.axis('equal') plt.ylim(-1.2, 1.2) plt.legend() def test_pie_textprops():
64
64
201
7
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_pie_textprops
test_pie_textprops
5,125
5,144
5,125
5,125
03a01f0c006b5a455bad9366db750161068a8898
bigcode/the-stack
train
296bca1f938ec7df987bd984
train
function
def test_tick_apply_tickdir_deprecation(): # Remove this test when the deprecation expires. import matplotlib.axis as maxis ax = plt.axes() tick = maxis.XTick(ax, 0) with pytest.warns(MatplotlibDeprecationWarning, match="The apply_tickdir function was deprecated in " ...
def test_tick_apply_tickdir_deprecation(): # Remove this test when the deprecation expires.
import matplotlib.axis as maxis ax = plt.axes() tick = maxis.XTick(ax, 0) with pytest.warns(MatplotlibDeprecationWarning, match="The apply_tickdir function was deprecated in " "Matplotlib 3.5"): tick.apply_tickdir('out') tick = max...
.subplots(1) ax.bar(df.loc[df['a'] == 1, 'b'], df.loc[df['a'] == 1, 'b'], align='center') fig.canvas.draw() def test_tick_apply_tickdir_deprecation(): # Remove this test when the deprecation expires.
64
64
140
20
44
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_tick_apply_tickdir_deprecation
test_tick_apply_tickdir_deprecation
5,844
5,859
5,844
5,845
b0309607c2621f0f7820153d83ab153033387f50
bigcode/the-stack
train
7b1b447903221c4e23b026d2
train
function
def test_remove_shared_axes_relim(): fig, ax_lst = plt.subplots(2, 2, sharex='all', sharey='all') ax = ax_lst[0][0] orig_xlim = ax_lst[0][1].get_xlim() ax.remove() ax.set_xlim(0, 5) assert_array_equal(ax_lst[0][1].get_xlim(), orig_xlim)
def test_remove_shared_axes_relim():
fig, ax_lst = plt.subplots(2, 2, sharex='all', sharey='all') ax = ax_lst[0][0] orig_xlim = ax_lst[0][1].get_xlim() ax.remove() ax.set_xlim(0, 5) assert_array_equal(ax_lst[0][1].get_xlim(), orig_xlim)
.8, .8]) return fig, ax def test_remove_shared_axes(shared_axes_generator, shared_axis_remover): # test all of the ways to get fig/ax sets fig, ax = shared_axes_generator shared_axis_remover(ax) def test_remove_shared_axes_relim():
64
64
87
8
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_remove_shared_axes_relim
test_remove_shared_axes_relim
5,724
5,730
5,724
5,724
2e471c9c983f42ea272ec8143286e501f0253d18
bigcode/the-stack
train
0c2afa56c1d1e005021e7ad2
train
function
def test_pandas_indexing_dates(pd): dates = np.arange('2005-02', '2005-03', dtype='datetime64[D]') values = np.sin(np.array(range(len(dates)))) df = pd.DataFrame({'dates': dates, 'values': values}) ax = plt.gca() without_zero_index = df[np.array(df.index) % 2 == 1].copy() ax.plot('date...
def test_pandas_indexing_dates(pd):
dates = np.arange('2005-02', '2005-03', dtype='datetime64[D]') values = np.sin(np.array(range(len(dates)))) df = pd.DataFrame({'dates': dates, 'values': values}) ax = plt.gca() without_zero_index = df[np.array(df.index) % 2 == 1].copy() ax.plot('dates', 'values', data=without_zero_index...
pd.date_range('2000-01-01', periods=10) depth = np.arange(20) data = np.random.rand(19, 9) fig, ax = plt.subplots() ax.pcolormesh(time, depth, data) def test_pandas_indexing_dates(pd):
64
64
104
9
55
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_pandas_indexing_dates
test_pandas_indexing_dates
5,799
5,807
5,799
5,799
710e59e3648f78aecf280ba5390ead2d9383497f
bigcode/the-stack
train
29a87c5e3ce3aa0c8f0cb10a
train
function
@image_comparison(['violinplot_horiz_custompoints_10.png']) def test_horiz_violinplot_custompoints_10(): ax = plt.axes() # First 9 digits of frac(sqrt(41)) np.random.seed(403124237) data = [np.random.normal(size=100) for _ in range(4)] ax.violinplot(data, positions=range(4), vert=False, showme...
@image_comparison(['violinplot_horiz_custompoints_10.png']) def test_horiz_violinplot_custompoints_10():
ax = plt.axes() # First 9 digits of frac(sqrt(41)) np.random.seed(403124237) 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=10)
0.9], [0.2, 0.8], [0.3, 0.7], [0.4, 0.6]]) @image_comparison(['violinplot_horiz_custompoints_10.png']) def test_horiz_violinplot_custompoints_10():
63
64
112
28
35
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_horiz_violinplot_custompoints_10
test_horiz_violinplot_custompoints_10
3,184
3,191
3,184
3,185
8d0b7613c27c7bdfa7c9ca3c453c5f24869a88e0
bigcode/the-stack
train
bc2f3dd8a0d5a760269e5f7e
train
function
@image_comparison(['test_eventplot_defaults.png'], remove_text=True) def test_eventplot_defaults(): """ test that eventplot produces the correct output given the default params (see bug #3728) """ np.random.seed(0) data1 = np.random.random([32, 20]).tolist() data2 = np.random.rando...
@image_comparison(['test_eventplot_defaults.png'], remove_text=True) def test_eventplot_defaults():
""" test that eventplot produces the correct output given the default params (see bug #3728) """ np.random.seed(0) data1 = np.random.random([32, 20]).tolist() data2 = np.random.random([6, 20]).tolist() data = data1 + data2 fig = plt.figure() axobj = fig.add_subplot()...
("pos", colors="c", lineoffsets="lo", linelengths="ll", data=data) num_collections = len(colls) assert num_collections == num_datasets @image_comparison(['test_eventplot_defaults.png'], remove_text=True) def test_eventplot_defaults():
64
64
114
21
42
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_eventplot_defaults
test_eventplot_defaults
4,031
4,045
4,031
4,032
62f1e37b9b0b1585d4559fb8d74b8658de832a89
bigcode/the-stack
train
d67179d0ec778283484d0be3
train
function
@image_comparison( ["psd_freqs.png", "csd_freqs.png", "psd_noise.png", "csd_noise.png"], remove_text=True, tol=0.002) def test_psd_csd(): n = 10000 Fs = 100. fstims = [[Fs/4, Fs/5, Fs/11], [Fs/4.7, Fs/5.6, Fs/11.9]] NFFT_freqs = int(1000 * Fs / np.min(fstims)) x = np.arange(0, n, 1...
@image_comparison( ["psd_freqs.png", "csd_freqs.png", "psd_noise.png", "csd_noise.png"], remove_text=True, tol=0.002) def test_psd_csd():
n = 10000 Fs = 100. fstims = [[Fs/4, Fs/5, Fs/11], [Fs/4.7, Fs/5.6, Fs/11.9]] NFFT_freqs = int(1000 * Fs / np.min(fstims)) x = np.arange(0, n, 1/Fs) ys_freqs = np.sin(2 * np.pi * np.multiply.outer(fstims, x)).sum(axis=1) NFFT_noise = int(1000 * Fs / 11) np.random.seed(0) ...
.rcParams["image.origin"] = 'lower' # Test: origin='lower' should be ignored fig_test.subplots().specgram(signal) def test_specgram_origin_kwarg(): """Ensure passing origin as a kwarg raises a TypeError.""" t = np.arange(500) signal = np.sin(t) with pytest.raises(TypeError): ...
136
137
457
50
86
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_psd_csd
test_psd_csd
4,607
4,638
4,607
4,610
6f402eec74eeead84f2d2e35fba250c357c215bb
bigcode/the-stack
train
32d188d086a0412ae7c7b382
train
function
def test_manage_xticks(): _, ax = plt.subplots() ax.set_xlim(0, 4) old_xlim = ax.get_xlim() np.random.seed(0) y1 = np.random.normal(10, 3, 20) y2 = np.random.normal(3, 1, 20) ax.boxplot([y1, y2], positions=[1, 2], manage_ticks=False) new_xlim = ax.get_xlim() assert_array_equ...
def test_manage_xticks():
_, ax = plt.subplots() ax.set_xlim(0, 4) old_xlim = ax.get_xlim() np.random.seed(0) y1 = np.random.normal(10, 3, 20) y2 = np.random.normal(3, 1, 20) ax.boxplot([y1, y2], positions=[1, 2], manage_ticks=False) new_xlim = ax.get_xlim() assert_array_equal(old_xlim, new_xlim)
index=list('ABCDEFGHI')) s3 = pd.Series(np.random.normal(size=11)) fig_test.subplots().violinplot([s1, s2, s3]) fig_ref.subplots().violinplot([s1.values, s2.values, s3.values]) def test_manage_xticks():
63
64
110
6
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_manage_xticks
test_manage_xticks
3,274
3,283
3,274
3,274
e3228fe2a6dff53114f41a57ea2f711e498a7db3
bigcode/the-stack
train
da67dcf181224ae97312ed5c
train
function
def _rc_test_bxp_helper(ax, rc_dict): x = np.linspace(-7, 7, 140) x = np.hstack([-25, x, 25]) with matplotlib.rc_context(rc_dict): ax.boxplot([x, x]) return ax
def _rc_test_bxp_helper(ax, rc_dict):
x = np.linspace(-7, 7, 140) x = np.hstack([-25, x, 25]) with matplotlib.rc_context(rc_dict): ax.boxplot([x, x]) return ax
_ylim((-5, 5)) fig2, ax2 = plt.subplots() ax2.boxplot([x, x], bootstrap=10000, notch=1, autorange=True) ax2.set_ylim((-5, 5)) def _rc_test_bxp_helper(ax, rc_dict):
63
64
61
12
51
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
_rc_test_bxp_helper
_rc_test_bxp_helper
2,896
2,901
2,896
2,896
37131f19523150cc0cd91099b379d091da163a8e
bigcode/the-stack
train
c2555d98a5c2f82a3771b67c
train
function
@image_comparison(['axhspan_epoch'], tol=0.02) def test_axhspan_epoch(): import matplotlib.testing.jpl_units as units units.register() # generate some data t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 20)) tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21)) dt = units.Dura...
@image_comparison(['axhspan_epoch'], tol=0.02) def test_axhspan_epoch():
import matplotlib.testing.jpl_units as units units.register() # generate some data t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 20)) tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21)) dt = units.Duration("ET", units.day.convert("sec")) ax = plt.gca() ax.axhspan(...
vspan(t0, tf, facecolor="blue", alpha=0.25) ax.set_xlim(t0 - 5.0*dt, tf + 5.0*dt) @image_comparison(['axhspan_epoch'], tol=0.02) def test_axhspan_epoch():
64
64
154
23
41
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_axhspan_epoch
test_axhspan_epoch
722
734
722
723
97404f52f119c8505a2b73c4526e72d6325f94f9
bigcode/the-stack
train
d5b6d6ac0cf05e67b23cac85
train
function
def test_bar_label_nan_ydata(): ax = plt.gca() bars = ax.bar([2, 3], [np.nan, 1]) labels = 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_bar_label_nan_ydata():
ax = plt.gca() bars = ax.bar([2, 3], [np.nan, 1]) labels = 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'
.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_nan_ydata():
63
64
86
8
55
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_bar_label_nan_ydata
test_bar_label_nan_ydata
7,137
7,143
7,137
7,137
645ca6f068e9177a1a6eed8bb4d4a703f4017891
bigcode/the-stack
train
7bf7a84f428b8d5535601a0d
train
function
def test_numerical_hist_label(): fig, ax = plt.subplots() ax.hist([range(15)] * 5, label=range(5)) ax.legend()
def test_numerical_hist_label():
fig, ax = plt.subplots() ax.hist([range(15)] * 5, label=range(5)) ax.legend()
2], color=None) 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_numerical_hist_label():
64
64
38
8
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_numerical_hist_label
test_numerical_hist_label
5,348
5,351
5,348
5,348
e40c228646b3d66813c1f80fa7f6df30d4c15d0b
bigcode/the-stack
train
3ba36029dbbc2ad744b1c4b1
train
function
@image_comparison(['hist_stacked_weights']) def test_hist_stacked_weighted(): # make some data d1 = np.linspace(0, 10, 50) d2 = np.linspace(1, 3, 20) w1 = np.linspace(0.01, 3.5, 50) w2 = np.linspace(0.05, 2., 20) fig, ax = plt.subplots() ax.hist((d1, d2), weights=(w1, w2), histtype="...
@image_comparison(['hist_stacked_weights']) def test_hist_stacked_weighted(): # make some data
d1 = np.linspace(0, 10, 50) d2 = np.linspace(1, 3, 20) w1 = np.linspace(0.01, 3.5, 50) w2 = np.linspace(0.05, 2., 20) fig, ax = plt.subplots() ax.hist((d1, d2), weights=(w1, w2), histtype="stepfilled", stacked=True)
= np.linspace(1, 3, 20) fig, ax = plt.subplots() ax.hist((d1, d2), histtype="step", orientation="horizontal") @image_comparison(['hist_stacked_weights']) def test_hist_stacked_weighted(): # make some data
63
64
125
24
39
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hist_stacked_weighted
test_hist_stacked_weighted
3,611
3,619
3,611
3,613
ca414b56b1cb5b8d113e4105140c342566265b74
bigcode/the-stack
train
8391e5546660b77d5704d0fc
train
function
@image_comparison(['axvspan_epoch']) def test_axvspan_epoch(): import matplotlib.testing.jpl_units as units units.register() # generate some data t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 20)) tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21)) dt = units.Duration("ET",...
@image_comparison(['axvspan_epoch']) def test_axvspan_epoch():
import matplotlib.testing.jpl_units as units units.register() # generate some data t0 = units.Epoch("ET", dt=datetime.datetime(2009, 1, 20)) tf = units.Epoch("ET", dt=datetime.datetime(2009, 1, 21)) dt = units.Duration("ET", units.day.convert("sec")) ax = plt.gca() ax.axvspan(...
fig, ax = plt.subplots(figsize=(8, 4.2), subplot_kw=dict(projection="aitoff")) ax.grid() ax.plot(X.flat, Y.flat, 'o', markersize=4) @image_comparison(['axvspan_epoch']) def test_axvspan_epoch():
64
64
148
17
47
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_axvspan_epoch
test_axvspan_epoch
707
719
707
708
dd2356d7aaafeceed1f9b6aef6b5878c642b1b3c
bigcode/the-stack
train
dcfbc98e81def7cfcdda765a
train
function
def test_title_xticks_top_both(): # Test that title moves if xticks on top of axes. mpl.rcParams['axes.titley'] = None fig, ax = plt.subplots() ax.tick_params(axis="x", bottom=True, top=True, labelbottom=True, labeltop=True) ax.set_title('xlabel top') fig.canvas.draw() ...
def test_title_xticks_top_both(): # Test that title moves if xticks on top of axes.
mpl.rcParams['axes.titley'] = None fig, ax = plt.subplots() ax.tick_params(axis="x", bottom=True, top=True, labelbottom=True, labeltop=True) ax.set_title('xlabel top') fig.canvas.draw() assert ax.title.get_position()[1] > 1.04
plt.subplots() ax.xaxis.set_ticks_position('top') ax.set_title('xlabel top') fig.canvas.draw() assert ax.title.get_position()[1] > 1.04 def test_title_xticks_top_both(): # Test that title moves if xticks on top of axes.
64
64
94
23
40
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_title_xticks_top_both
test_title_xticks_top_both
6,041
6,049
6,041
6,042
a263aa4e851f5064b1263c38360c20a31d174b74
bigcode/the-stack
train
73d3494679d6c3a5df76e384
train
function
@image_comparison(['formatter_ticker_001', 'formatter_ticker_002', 'formatter_ticker_003', 'formatter_ticker_004', 'formatter_ticker_005', ]) def test_formatter_ticker(): import matplotlib.testing.jpl_units as unit...
@image_comparison(['formatter_ticker_001', 'formatter_ticker_002', 'formatter_ticker_003', 'formatter_ticker_004', 'formatter_ticker_005', ]) def test_formatter_ticker():
import matplotlib.testing.jpl_units as units units.register() # This should affect the tick size. (Tests issue #543) matplotlib.rcParams['lines.markeredgewidth'] = 30 # This essentially test to see if user specified labels get overwritten # by the auto labeler functionality of the axes...
check_figures_equal(extensions=["png"]) def test_matshow(fig_test, fig_ref): mpl.style.use("mpl20") a = np.random.rand(32, 32) fig_test.add_subplot().matshow(a) ax_ref = fig_ref.add_subplot() ax_ref.imshow(a) ax_ref.xaxis.tick_top() ax_ref.xaxis.set_ticks_position('both') @image_comp...
136
137
458
52
84
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_formatter_ticker
test_formatter_ticker
167
209
167
173
77cb9ed372b7063665c71def9faffd902b7bc857
bigcode/the-stack
train
e442b08f26ed291c7495d320
train
function
def test_hist_range_and_density(): _, bins, _ = plt.hist(np.random.rand(10), "auto", range=(0, 1), density=True) assert bins[0] == 0 assert bins[-1] == 1
def test_hist_range_and_density():
_, bins, _ = plt.hist(np.random.rand(10), "auto", range=(0, 1), density=True) assert bins[0] == 0 assert bins[-1] == 1
, _ = 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, nanedges) def test_hist_range_and_density():
64
64
55
7
57
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hist_range_and_density
test_hist_range_and_density
6,771
6,775
6,771
6,771
7a28da9376a2f3c7f1a1fa8044b27bbbb5494dea
bigcode/the-stack
train
625b2af68e0fe8dfe0e7157f
train
function
def test_hist_labels(): # test singleton labels OK fig, ax = plt.subplots() _, _, bars = ax.hist([0, 1], label=0) assert bars[0].get_label() == '0' _, _, bars = ax.hist([0, 1], label=[0]) assert bars[0].get_label() == '0' _, _, bars = ax.hist([0, 1], label=None) assert bars[0].ge...
def test_hist_labels(): # test singleton labels OK
fig, ax = plt.subplots() _, _, bars = ax.hist([0, 1], label=0) assert bars[0].get_label() == '0' _, _, bars = ax.hist([0, 1], label=[0]) assert bars[0].get_label() == '0' _, _, bars = ax.hist([0, 1], label=None) assert bars[0].get_label() == '_nolegend_' _, _, bars = ax.hist([0, 1...
stacked", bottom=b) assert b.tolist() == [10, 20] def test_hist_emptydata(): fig, ax = plt.subplots() ax.hist([[], range(10), range(10)], histtype="step") def test_hist_labels(): # test singleton labels OK
63
64
172
12
51
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hist_labels
test_hist_labels
3,864
3,876
3,864
3,865
099579e26d65ceb9c52fc3cf803a3a4768241636
bigcode/the-stack
train
aaefd77b98969e150c2d3cb4
train
function
def test_specgram_fs_none(): """Test axes.specgram when Fs is None, should not throw error.""" spec, freqs, t, im = plt.specgram(np.ones(300), Fs=None, scale='linear') xmin, xmax, freq0, freq1 = im.get_extent() assert xmin == 32 and xmax == 96
def test_specgram_fs_none():
"""Test axes.specgram when Fs is None, should not throw error.""" spec, freqs, t, im = plt.specgram(np.ones(300), Fs=None, scale='linear') xmin, xmax, freq0, freq1 = im.get_extent() assert xmin == 32 and xmax == 96
ides, mode=mode) with pytest.raises(ValueError): ax.specgram(y, NFFT=NFFT, Fs=Fs, noverlap=noverlap, pad_to=pad_to, sides=sides, mode=mode, scale="dB") def test_specgram_fs_none():
63
64
76
7
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_specgram_fs_none
test_specgram_fs_none
4,573
4,577
4,573
4,573
553f931fa4880fcb73118df36509a7fdd3581a12
bigcode/the-stack
train
17b0c80ce76955ce252677b6
train
function
@image_comparison(['date_timezone_x.png'], tol=1.0) def test_date_timezone_x(): # Tests issue 5575 time_index = [datetime.datetime(2016, 2, 22, hour=x, tzinfo=dateutil.tz.gettz('Canada/Eastern')) for x in range(3)] # Same Timezone plt.figure...
@image_comparison(['date_timezone_x.png'], tol=1.0) def test_date_timezone_x(): # Tests issue 5575
time_index = [datetime.datetime(2016, 2, 22, hour=x, tzinfo=dateutil.tz.gettz('Canada/Eastern')) for x in range(3)] # Same Timezone plt.figure(figsize=(20, 12)) plt.subplot(2, 1, 1) plt.plot_date(time_index, [3] * 3, tz='Canada/Eastern') ...
4, 5], align="edge") for (patch, x) in zip(b.patches, xs): assert patch.xy[0] == x @image_comparison(['date_timezone_x.png'], tol=1.0) def test_date_timezone_x(): # Tests issue 5575
64
64
157
30
33
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_date_timezone_x
test_date_timezone_x
5,930
5,944
5,930
5,932
00086b60e1b6448afd2ebcb3138d82ecc6a7ab7d
bigcode/the-stack
train
dc95d85499192734910a0fe1
train
function
@image_comparison(['arrow_simple.png'], remove_text=True) def test_arrow_simple(): # Simple image test for ax.arrow # kwargs that take discrete values length_includes_head = (True, False) shape = ('full', 'left', 'right') head_starts_at_zero = (True, False) # Create outer product of value...
@image_comparison(['arrow_simple.png'], remove_text=True) def test_arrow_simple(): # Simple image test for ax.arrow # kwargs that take discrete values
length_includes_head = (True, False) shape = ('full', 'left', 'right') head_starts_at_zero = (True, False) # Create outer product of values kwargs = product(length_includes_head, shape, head_starts_at_zero) fig, axs = plt.subplots(3, 4) for i, (ax, kwarg) in enumerate(zip(axs.flat, k...
=3, color='purple') ax.annotate('local max', xy=(3, 1), xycoords='data', xytext=(3, 3), textcoords='offset points') @image_comparison(['arrow_simple.png'], remove_text=True) def test_arrow_simple(): # Simple image test for ax.arrow # kwargs that take discrete values
77
78
261
35
42
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_arrow_simple
test_arrow_simple
538
562
538
541
bc4cf7385850799af71f9fc5b82bf2cf901fff88
bigcode/the-stack
train
c6c4253582d4831ff8979e81
train
function
def test_title_no_move_off_page(): # If an axes is off the figure (ie. if it is cropped during a save) # make sure that the automatic title repositioning does not get done. mpl.rcParams['axes.titley'] = None fig = plt.figure() ax = fig.add_axes([0.1, -0.5, 0.8, 0.2]) ax.tick_params(axis="x...
def test_title_no_move_off_page(): # If an axes is off the figure (ie. if it is cropped during a save) # make sure that the automatic title repositioning does not get done.
mpl.rcParams['axes.titley'] = None fig = plt.figure() ax = fig.add_axes([0.1, -0.5, 0.8, 0.2]) ax.tick_params(axis="x", bottom=True, top=True, labelbottom=True, labeltop=True) tt = ax.set_title('Boo') fig.canvas.draw() assert tt.get_position()[1] == 1.0
') fig.canvas.draw() assert ax.title.get_position()[1] > 1.04 def test_title_no_move_off_page(): # If an axes is off the figure (ie. if it is cropped during a save) # make sure that the automatic title repositioning does not get done.
64
64
139
43
20
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_title_no_move_off_page
test_title_no_move_off_page
6,052
6,062
6,052
6,054
9b90a02e179efe563856d5de730f2bcdd746296c
bigcode/the-stack
train
836be3f45d8313db44e77e48
train
function
def test_reset_grid(): fig, ax = plt.subplots() ax.tick_params(reset=True, which='major', labelsize=10) assert not ax.xaxis.majorTicks[0].gridline.get_visible() ax.grid(color='red') # enables grid assert ax.xaxis.majorTicks[0].gridline.get_visible() with plt.rc_context({'axes.grid': Tru...
def test_reset_grid():
fig, ax = plt.subplots() ax.tick_params(reset=True, which='major', labelsize=10) assert not ax.xaxis.majorTicks[0].gridline.get_visible() ax.grid(color='red') # enables grid assert ax.xaxis.majorTicks[0].gridline.get_visible() with plt.rc_context({'axes.grid': True}): ax.clear()...
0].gridline.get_visible() ax.grid(visible=True) fig.canvas.draw() assert ax.xaxis.majorTicks[0].gridline.get_visible() ax.grid() fig.canvas.draw() assert not ax.xaxis.majorTicks[0].gridline.get_visible() def test_reset_grid():
64
64
119
5
59
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_reset_grid
test_reset_grid
4,815
4,825
4,815
4,815
9570942335d4f71e182e0f69694b9ccd9da6006f
bigcode/the-stack
train
a6f5bd58b2b5742fc7204827
train
function
def test_color_length_mismatch(): N = 5 x, y = np.arange(N), np.arange(N) colors = np.arange(N+1) fig, ax = plt.subplots() with pytest.raises(ValueError): ax.scatter(x, y, c=colors) c_rgb = (0.5, 0.5, 0.5) ax.scatter(x, y, c=c_rgb) ax.scatter(x, y, c=[c_rgb] * N)
def test_color_length_mismatch():
N = 5 x, y = np.arange(N), np.arange(N) colors = np.arange(N+1) fig, ax = plt.subplots() with pytest.raises(ValueError): ax.scatter(x, y, c=colors) c_rgb = (0.5, 0.5, 0.5) ax.scatter(x, y, c=c_rgb) ax.scatter(x, y, c=[c_rgb] * N)
, x1t = transform.transform([10, 100]) delta = (x1t - x0t) * margin assert_allclose([xlim0t + delta, xlim1t - delta], [x0t, x1t]) def test_color_length_mismatch():
63
64
106
7
56
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_color_length_mismatch
test_color_length_mismatch
6,175
6,184
6,175
6,175
4646e9657f769aa2584ec409ba441d627b1eb4e9
bigcode/the-stack
train
caffddb5e227513147f3da7d
train
function
def test_hlines_default(): fig, ax = plt.subplots() with mpl.rc_context({'lines.color': 'red'}): lines = ax.hlines(0.5, 0, 1) assert mpl.colors.same_color(lines.get_color(), 'red')
def test_hlines_default():
fig, ax = plt.subplots() with mpl.rc_context({'lines.color': 'red'}): lines = ax.hlines(0.5, 0, 1) assert mpl.colors.same_color(lines.get_color(), 'red')
.ma.masked_equal([13, 14, 15, 16, 17, 18], 18) ax5.hlines(y5, xmin5, xmax5, colors='k', linewidth=2) ax5.set_ylim(0, 15) def test_hlines_default():
64
64
57
6
58
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hlines_default
test_hlines_default
4,375
4,379
4,375
4,375
01d8bd31dcfb8e61e5c0f28b9a3d4e68467f092e
bigcode/the-stack
train
5700e58207315e48896f32e4
train
function
def test_hist_stacked_stepfilled_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='stepfilled') ...
def test_hist_stacked_stepfilled_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='stepfilled') assert len(patches) == 2 polygon, = pa...
, 2, 1.5], histtype='step') xy = [[0, 1], [0, 3], [1, 3], [1, 5], [2, 5], [2, 2.5], [3, 2.5], [3, 1.5]] assert_array_equal(polygon.get_xy(), xy) def test_hist_stacked_stepfilled_geometry():
92
92
307
9
83
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_hist_stacked_stepfilled_geometry
test_hist_stacked_stepfilled_geometry
3,749
3,768
3,749
3,749
55749a9af0223241e0259c7cab8467bac3628106
bigcode/the-stack
train
589be1f44d1fb5748a80cef5
train
function
@pytest.mark.parametrize('ha', ['left', 'center', 'right']) def test_ylabel_ha_with_position(ha): fig = Figure() ax = fig.subplots() ax.set_ylabel("test", y=1, ha=ha) ax.yaxis.set_label_position("right") assert ax.yaxis.get_label().get_ha() == ha
@pytest.mark.parametrize('ha', ['left', 'center', 'right']) def test_ylabel_ha_with_position(ha):
fig = Figure() ax = fig.subplots() ax.set_ylabel("test", y=1, ha=ha) ax.yaxis.set_label_position("right") assert ax.yaxis.get_label().get_ha() == ha
, 2.5]) # should affect all axes ylims for ax in axs.flat: assert ax.get_ylim() == axs[0, 0].get_ylim() @pytest.mark.parametrize('ha', ['left', 'center', 'right']) def test_ylabel_ha_with_position(ha):
64
64
76
25
39
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_ylabel_ha_with_position
test_ylabel_ha_with_position
7,060
7,066
7,060
7,061
2ae40aa620f6396a54fbfb174ff2ee0fc080b10a
bigcode/the-stack
train
eb489e388178d28350c70d58
train
function
def test_grid(): fig, ax = plt.subplots() ax.grid() fig.canvas.draw() assert ax.xaxis.majorTicks[0].gridline.get_visible() ax.grid(visible=False) fig.canvas.draw() assert not ax.xaxis.majorTicks[0].gridline.get_visible() ax.grid(visible=True) fig.canvas.draw() assert ax...
def test_grid():
fig, ax = plt.subplots() ax.grid() fig.canvas.draw() assert ax.xaxis.majorTicks[0].gridline.get_visible() ax.grid(visible=False) fig.canvas.draw() assert not ax.xaxis.majorTicks[0].gridline.get_visible() ax.grid(visible=True) fig.canvas.draw() assert ax.xaxis.majorTicks[...
, ax = plt.subplots() fig.canvas.draw() assert all(tick.gridline.get_visible() == major_visible for tick in ax.xaxis.majorTicks) assert all(tick.gridline.get_visible() == minor_visible for tick in ax.xaxis.minorTicks) def test_grid():
64
64
116
4
60
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_grid
test_grid
4,799
4,812
4,799
4,799
68589a65c3ecf1f05165ce9255a97febb5f514bf
bigcode/the-stack
train
c48eaffc9262bd431da6f3f9
train
function
def test_vline_limit(): fig = plt.figure() ax = fig.gca() ax.axvline(0.5) ax.plot([-0.1, 0, 0.2, 0.1]) assert_allclose(ax.get_ylim(), (-.1, .2))
def test_vline_limit():
fig = plt.figure() ax = fig.gca() ax.axvline(0.5) ax.plot([-0.1, 0, 0.2, 0.1]) assert_allclose(ax.get_ylim(), (-.1, .2))
we've changed any setting on ticks, reset_ticks will mean # re-creating them from scratch. This *should* appear the same as not # resetting them. for ax in fig_test.axes: ax.xaxis.reset_ticks() ax.yaxis.reset_ticks() def test_vline_limit():
64
64
65
6
58
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_vline_limit
test_vline_limit
4,848
4,853
4,848
4,848
52855187402e1404c753ea221571099ce525f326
bigcode/the-stack
train
ab6c6bd8d0fda1064f1c208d
train
function
def test_xtickcolor_is_not_xticklabelcolor(): plt.rcParams['xtick.color'] = 'yellow' plt.rcParams['xtick.labelcolor'] = 'blue' ax = plt.axes() ticks = ax.xaxis.get_major_ticks() for tick in ticks: assert tick.tick1line.get_color() == 'yellow' assert tick.label1.get_color() == ...
def test_xtickcolor_is_not_xticklabelcolor():
plt.rcParams['xtick.color'] = 'yellow' plt.rcParams['xtick.labelcolor'] = 'blue' ax = plt.axes() ticks = ax.xaxis.get_major_ticks() for tick in ticks: assert tick.tick1line.get_color() == 'yellow' assert tick.label1.get_color() == 'blue'
test_autoscale_tiny_sticky(): fig, ax = plt.subplots() ax.bar(0, 1e-9) fig.canvas.draw() assert ax.get_ylim() == (0, 1.05e-9) def test_xtickcolor_is_not_xticklabelcolor():
64
64
86
12
52
arnoyu-hub/COMP0016miemie
venv/Lib/site-packages/matplotlib/tests/test_axes.py
Python
test_xtickcolor_is_not_xticklabelcolor
test_xtickcolor_is_not_xticklabelcolor
6,959
6,966
6,959
6,959
36ec47f385701f83a1748fe3a375234a9bbb7c0c
bigcode/the-stack
train