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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3095e39715f8922a998f3c2d | train | function | @image_comparison(['pie_rotatelabels_true.png'])
def test_pie_rotatelabels_true():
# The slices will be ordered and plotted counter-clockwise.
labels = 'Hogwarts', 'Frogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
explode = (0, 0.1,... | @image_comparison(['pie_rotatelabels_true.png'])
def test_pie_rotatelabels_true():
# The slices will be ordered and plotted counter-clockwise.
| labels = 'Hogwarts', 'Frogs', '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%... | , 5))
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
@image_comparison(['pie_rotatelabels_true.png'])
def test_pie_rotatelabels_true():
# The slices will be ordered and plotted counter-clockwise.
| 63 | 64 | 193 | 36 | 27 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pie_rotatelabels_true | test_pie_rotatelabels_true | 5,096 | 5,108 | 5,096 | 5,098 | a8a433497590ffb0cdad65c3992fbc9a0836ca29 | bigcode/the-stack | train |
3f6980a376161bec0fd47c6f | train | function | def test_twinx_knows_limits():
fig, ax = plt.subplots()
ax.axvspan(1, 2)
xtwin = ax.twinx()
xtwin.plot([0, 0.5], [1, 2])
# control axis
fig2, ax2 = plt.subplots()
ax2.axvspan(1, 2)
ax2.plot([0, 0.5], [1, 2])
assert_array_equal(xtwin.viewLim.intervalx, ax2.viewLim.inter... | def test_twinx_knows_limits():
| fig, ax = plt.subplots()
ax.axvspan(1, 2)
xtwin = ax.twinx()
xtwin.plot([0, 0.5], [1, 2])
# control axis
fig2, ax2 = plt.subplots()
ax2.axvspan(1, 2)
ax2.plot([0, 0.5], [1, 2])
assert_array_equal(xtwin.viewLim.intervalx, ax2.viewLim.intervalx)
| orticks_on(xscale, yscale):
ax = plt.subplot()
ax.plot([1, 2, 3, 4])
ax.set_xscale(xscale)
ax.set_yscale(yscale)
ax.minorticks_on()
def test_twinx_knows_limits():
| 64 | 64 | 119 | 9 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_twinx_knows_limits | test_twinx_knows_limits | 6,226 | 6,238 | 6,226 | 6,226 | 8c8ef355c1f4b4cb0b74f071ef3808c7adb68aac | bigcode/the-stack | train |
b89a0783f997c91312ec6af1 | train | function | @image_comparison(['violinplot_vert_showmedians.png'])
def test_vert_violinplot_showmedians():
ax = plt.axes()
# First 9 digits of frac(sqrt(7))
np.random.seed(645751311)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
... | @image_comparison(['violinplot_vert_showmedians.png'])
def test_vert_violinplot_showmedians():
| ax = plt.axes()
# First 9 digits of frac(sqrt(7))
np.random.seed(645751311)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
showmedians=1)
| 100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showextrema=1,
showmedians=0)
@image_comparison(['violinplot_vert_showmedians.png'])
def test_vert_violinplot_showmedians():
| 64 | 64 | 101 | 24 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_vert_violinplot_showmedians | test_vert_violinplot_showmedians | 3,092 | 3,099 | 3,092 | 3,093 | 33eda076f2a2e587004bd7623490cfd5b65aeb80 | bigcode/the-stack | train |
be35140e4f0585789e31e5d2 | train | function | def test_margins():
# test all ways margins can be called
data = [1, 10]
xmin = 0.0
xmax = len(data) - 1.0
ymin = min(data)
ymax = max(data)
fig1, ax1 = plt.subplots(1, 1)
ax1.plot(data)
ax1.margins(1)
assert ax1.margins() == (1, 1)
assert ax1.get_xlim() == (xmin... | def test_margins():
# test all ways margins can be called
| data = [1, 10]
xmin = 0.0
xmax = len(data) - 1.0
ymin = min(data)
ymax = max(data)
fig1, ax1 = plt.subplots(1, 1)
ax1.plot(data)
ax1.margins(1)
assert ax1.margins() == (1, 1)
assert ax1.get_xlim() == (xmin - (xmax - xmin) * 1,
xmax + (xma... | _path_snap.png'], savefig_kwarg={'dpi': 72})
def test_o_marker_path_snap():
fig, ax = plt.subplots()
ax.margins(.1)
for ms in range(1, 15):
ax.plot([1, 2, ], np.ones(2) + ms, 'o', ms=ms)
for ms in np.linspace(1, 10, 25):
ax.plot([3, 4, ], np.ones(2) + ms, 'o', ms=ms)
def test_ma... | 129 | 129 | 431 | 16 | 113 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_margins | test_margins | 5,277 | 5,310 | 5,277 | 5,278 | f3958835d3d73ecead94c077e2dff4c033e4be71 | bigcode/the-stack | train |
2986ac338c6bcb2d335cc8e0 | train | function | @image_comparison(['hist_log'], remove_text=True)
def test_hist_log():
data0 = np.linspace(0, 1, 200)**3
data = np.concatenate([1 - data0, 1 + data0])
fig, ax = plt.subplots()
ax.hist(data, fill=False, log=True)
| @image_comparison(['hist_log'], remove_text=True)
def test_hist_log():
| data0 = np.linspace(0, 1, 200)**3
data = np.concatenate([1 - data0, 1 + data0])
fig, ax = plt.subplots()
ax.hist(data, fill=False, log=True)
| ets do not warn
x = pd.Series([1, 2], dtype="float64")
plt.plot(x, x)
plt.plot(x.index, x)
plt.plot(x)
plt.plot(x.index)
@image_comparison(['hist_log'], remove_text=True)
def test_hist_log():
| 64 | 64 | 70 | 17 | 47 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_log | test_hist_log | 1,736 | 1,741 | 1,736 | 1,737 | 0ace1a2240854bbb30c6b8d4888abcd6c9971a18 | bigcode/the-stack | train |
4f1bc488bd243a696201da21 | train | function | @image_comparison(['mollweide_grid'], remove_text=True)
def test_mollweide_grid():
# test that both horizontal and vertical gridlines appear on the Mollweide
# projection
fig = plt.figure()
ax = fig.add_subplot(projection='mollweide')
ax.grid()
| @image_comparison(['mollweide_grid'], remove_text=True)
def test_mollweide_grid():
# test that both horizontal and vertical gridlines appear on the Mollweide
# projection
| fig = plt.figure()
ax = fig.add_subplot(projection='mollweide')
ax.grid()
| ax in axs:
ax.axis([-1, 4, 0, 5])
@image_comparison(['mollweide_grid'], remove_text=True)
def test_mollweide_grid():
# test that both horizontal and vertical gridlines appear on the Mollweide
# projection
| 63 | 64 | 68 | 44 | 19 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_mollweide_grid | test_mollweide_grid | 3,905 | 3,911 | 3,905 | 3,908 | c57097e6d64d55d9b6d2949d869ffb0ba386d079 | bigcode/the-stack | train |
697fbb427bee9ffd867ce7ee | train | function | def test_bar_ticklabel_fail():
fig, ax = plt.subplots()
ax.bar([], [])
| def test_bar_ticklabel_fail():
| fig, ax = plt.subplots()
ax.bar([], [])
| = plt.gca()
ax.bar("a", "b", align='edge', tick_label='0', data=data)
def test_nan_bar_values():
fig, ax = plt.subplots()
ax.bar([0, 1], [np.nan, 4])
def test_bar_ticklabel_fail():
| 63 | 64 | 21 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_ticklabel_fail | test_bar_ticklabel_fail | 1,518 | 1,520 | 1,518 | 1,518 | 9b8aa4e8b3f306ace07f52574bb166c6b3b570ba | bigcode/the-stack | train |
e3cbcaa8bce2fd7717f231fb | train | function | def test_shared_with_aspect_1():
# allow sharing one axis
for adjustable in ['box', 'datalim']:
fig, axs = plt.subplots(nrows=2, sharex=True)
axs[0].set_aspect(2, adjustable=adjustable, share=True)
assert axs[1].get_aspect() == 2
assert axs[1].get_adjustable() == adjustable... | def test_shared_with_aspect_1():
# allow sharing one axis
| for adjustable in ['box', 'datalim']:
fig, axs = plt.subplots(nrows=2, sharex=True)
axs[0].set_aspect(2, adjustable=adjustable, share=True)
assert axs[1].get_aspect() == 2
assert axs[1].get_adjustable() == adjustable
fig, axs = plt.subplots(nrows=2, sharex=True)
... | _xlim()
y0, y1 = axs[1].get_ylim()
assert x0 <= 1
assert x1 >= 3
assert y0 <= 2
assert y1 >= 6
def test_shared_with_aspect_1():
# allow sharing one axis
| 64 | 64 | 137 | 16 | 47 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_shared_with_aspect_1 | test_shared_with_aspect_1 | 4,884 | 4,894 | 4,884 | 4,885 | af246d267d1cfce6592af238b3e0c66cc721df4e | bigcode/the-stack | train |
bcc17326d22df3f0260a7c8a | train | function | def test_sharing_does_not_link_positions():
fig = plt.figure()
ax0 = fig.add_subplot(221)
ax1 = fig.add_axes([.6, .6, .3, .3], sharex=ax0)
init_pos = ax1.get_position()
fig.subplots_adjust(left=0)
assert (ax1.get_position().get_points() == init_pos.get_points()).all()
| def test_sharing_does_not_link_positions():
| fig = plt.figure()
ax0 = fig.add_subplot(221)
ax1 = fig.add_axes([.6, .6, .3, .3], sharex=ax0)
init_pos = ax1.get_position()
fig.subplots_adjust(left=0)
assert (ax1.get_position().get_points() == init_pos.get_points()).all()
| 4], [2, 3, 2, 3])
ax2.axhspan(-5, 5)
xlim = ax1.get_xlim()
assert np.allclose(xlim, [0.5, 4.5])
def test_sharing_does_not_link_positions():
| 63 | 64 | 87 | 10 | 53 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_sharing_does_not_link_positions | test_sharing_does_not_link_positions | 7,002 | 7,008 | 7,002 | 7,002 | 72f72af02da9847a74ba6ca6a7586d4f77e1507a | bigcode/the-stack | train |
b14237624e03bc9486c6e7ba | train | function | @image_comparison(['boxplot_rc_parameters'],
savefig_kwarg={'dpi': 100}, remove_text=True,
tol=1, style='default')
def test_boxplot_rc_parameters():
# Randomness used for bootstrapping.
np.random.seed(937)
fig, ax = plt.subplots(3)
rc_axis0 = {
'bo... | @image_comparison(['boxplot_rc_parameters'],
savefig_kwarg={'dpi': 100}, remove_text=True,
tol=1, style='default')
def test_boxplot_rc_parameters():
# Randomness used for bootstrapping.
| np.random.seed(937)
fig, ax = plt.subplots(3)
rc_axis0 = {
'boxplot.notch': True,
'boxplot.whiskers': [5, 95],
'boxplot.bootstrap': 10000,
'boxplot.flierprops.color': 'b',
'boxplot.flierprops.marker': 'o',
'boxplot.flierprops.markerfacecolor': 'g... | =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))
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):
a... | 171 | 171 | 570 | 51 | 119 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_rc_parameters | test_boxplot_rc_parameters | 2,904 | 2,966 | 2,904 | 2,908 | 4558dff628cae2010a0b2b6178552741be955077 | bigcode/the-stack | train |
012804c8c3f45890161c01d3 | train | function | @check_figures_equal()
def test_axline_transaxes_panzoom(fig_test, fig_ref):
# test that it is robust against pan/zoom and
# figure resize after plotting
ax = fig_test.subplots()
ax.set(xlim=(-1, 1), ylim=(-1, 1))
ax.axline((0, 0), slope=1, transform=ax.transAxes)
ax.axline((0.5, 0.5), sl... | @check_figures_equal()
def test_axline_transaxes_panzoom(fig_test, fig_ref):
# test that it is robust against pan/zoom and
# figure resize after plotting
| ax = fig_test.subplots()
ax.set(xlim=(-1, 1), ylim=(-1, 1))
ax.axline((0, 0), slope=1, transform=ax.transAxes)
ax.axline((0.5, 0.5), slope=2, color='C1', transform=ax.transAxes)
ax.axline((0.5, 0.5), slope=0, color='C2', transform=ax.transAxes)
ax.set(xlim=(0, 5), ylim=(0, 10))
fig_tes... | ([-1, 1], [0, 0], color='C2')
ax.plot([0, 0], [-1, 1], color='C3')
@check_figures_equal()
def test_axline_transaxes_panzoom(fig_test, fig_ref):
# test that it is robust against pan/zoom and
# figure resize after plotting
| 77 | 78 | 262 | 40 | 37 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axline_transaxes_panzoom | test_axline_transaxes_panzoom | 4,248 | 4,265 | 4,248 | 4,251 | ce402665477e38a6cd23ec173cd533f42c4377e0 | bigcode/the-stack | train |
aa03c058a69fcfe0f780e74a | train | function | def test_axline_args():
"""Exactly one of *xy2* and *slope* must be specified."""
fig, ax = plt.subplots()
with pytest.raises(TypeError):
ax.axline((0, 0)) # missing second parameter
with pytest.raises(TypeError):
ax.axline((0, 0), (1, 1), slope=1) # redundant parameters
ax.... | def test_axline_args():
| """Exactly one of *xy2* and *slope* must be specified."""
fig, ax = plt.subplots()
with pytest.raises(TypeError):
ax.axline((0, 0)) # missing second parameter
with pytest.raises(TypeError):
ax.axline((0, 0), (1, 1), slope=1) # redundant parameters
ax.set_xscale('log')
wi... | 3)
ax.plot([0, 5], [0, 5])
ax.plot([0, 5], [0, 10], color='C1')
ax.plot([0, 5], [5, 5], color='C2')
def test_axline_args():
| 63 | 64 | 200 | 6 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axline_args | test_axline_args | 4,268 | 4,285 | 4,268 | 4,268 | c4a0b52046105c52b0a798e7081ef3dd7779a058 | bigcode/the-stack | train |
088be058c2b7296fa3ffc8d8 | train | function | @image_comparison(["test_loglog_nonpos.png"], remove_text=True, style='mpl20')
def test_loglog_nonpos():
fig, axs = plt.subplots(3, 3)
x = np.arange(1, 11)
y = x**3
y[7] = -3.
x[4] = -10
for (mcy, mcx), ax in zip(product(['mask', 'clip', ''], repeat=2),
axs.... | @image_comparison(["test_loglog_nonpos.png"], remove_text=True, style='mpl20')
def test_loglog_nonpos():
| fig, axs = plt.subplots(3, 3)
x = np.arange(1, 11)
y = x**3
y[7] = -3.
x[4] = -10
for (mcy, mcx), ax in zip(product(['mask', 'clip', ''], repeat=2),
axs.flat):
if mcx == mcy:
if mcx:
ax.loglog(x, y**3, lw=2, nonpositive=m... | **3, lw=5)
ax.tick_params(length=25, width=2)
ax.tick_params(length=15, width=2, which='minor')
@image_comparison(["test_loglog_nonpos.png"], remove_text=True, style='mpl20')
def test_loglog_nonpos():
| 63 | 64 | 211 | 28 | 35 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_loglog_nonpos | test_loglog_nonpos | 5,626 | 5,645 | 5,626 | 5,627 | 8caebe1aad875e266d96f1055069f33c747dc8a1 | bigcode/the-stack | train |
dfe12f461dcc5fdc2423f42c | train | function | @image_comparison(['twin_autoscale.png'])
def test_twinx_axis_scales():
x = np.array([0, 0.5, 1])
y = 0.5 * x
x2 = np.array([0, 1, 2])
y2 = 2 * x2
fig = plt.figure()
ax = fig.add_axes((0, 0, 1, 1), autoscalex_on=False, autoscaley_on=False)
ax.plot(x, y, color='blue', lw=10)
... | @image_comparison(['twin_autoscale.png'])
def test_twinx_axis_scales():
| x = np.array([0, 0.5, 1])
y = 0.5 * x
x2 = np.array([0, 1, 2])
y2 = 2 * x2
fig = plt.figure()
ax = fig.add_axes((0, 0, 1, 1), autoscalex_on=False, autoscaley_on=False)
ax.plot(x, y, color='blue', lw=10)
ax2 = plt.twinx(ax)
ax2.plot(x2, y2, 'r--', lw=5)
ax.margins(0... | mpl.rcParams['axes.edgecolor'],
linewidth=mpl.rcParams['axes.linewidth'],
capstyle='projecting'))
remove_ticks_and_titles(fig_test)
remove_ticks_and_titles(fig_ref)
@image_comparison(['twin_autoscale.png'])
def test_twinx_axis_scales():
| 64 | 64 | 174 | 21 | 43 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_twinx_axis_scales | test_twinx_axis_scales | 355 | 370 | 355 | 356 | 6521e95daceeea20907a9457f0e5c40e440545c1 | bigcode/the-stack | train |
eed1b2c511a46078e82a9a47 | train | function | @image_comparison(['hist_offset'])
def test_hist_offset():
# make some data
d1 = np.linspace(0, 10, 50)
d2 = np.linspace(1, 3, 20)
fig, ax = plt.subplots()
ax.hist(d1, bottom=5)
ax.hist(d2, bottom=15)
| @image_comparison(['hist_offset'])
def test_hist_offset():
# make some data
| d1 = np.linspace(0, 10, 50)
d2 = np.linspace(1, 3, 20)
fig, ax = plt.subplots()
ax.hist(d1, bottom=5)
ax.hist(d2, bottom=15)
| for a labeled data test
data = {"x": (d1, d2)}
fig, ax = plt.subplots()
ax.hist("x", histtype="stepfilled", stacked=True, data=data)
@image_comparison(['hist_offset'])
def test_hist_offset():
# make some data
| 64 | 64 | 77 | 19 | 45 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_offset | test_hist_offset | 3,582 | 3,589 | 3,582 | 3,584 | 64189727edf622d6003b5533539eb1baedc21a5a | bigcode/the-stack | train |
260c6759886194a314549091 | train | function | @image_comparison(["loglog.png"], remove_text=True, tol=0.02)
def test_loglog():
fig, ax = plt.subplots()
x = np.arange(1, 11)
ax.loglog(x, x**3, lw=5)
ax.tick_params(length=25, width=2)
ax.tick_params(length=15, width=2, which='minor')
| @image_comparison(["loglog.png"], remove_text=True, tol=0.02)
def test_loglog():
| fig, ax = plt.subplots()
x = np.arange(1, 11)
ax.loglog(x, x**3, lw=5)
ax.tick_params(length=25, width=2)
ax.tick_params(length=15, width=2, which='minor')
| .get_title(loc='center')
with pytest.raises(ValueError):
ax.get_title(loc='foo')
with pytest.raises(ValueError):
ax.set_title('fail', loc='foo')
@image_comparison(["loglog.png"], remove_text=True, tol=0.02)
def test_loglog():
| 63 | 64 | 85 | 24 | 39 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_loglog | test_loglog | 5,617 | 5,623 | 5,617 | 5,618 | 0524d92d67e48dd1266b0b51fa5961223756b9b6 | bigcode/the-stack | train |
9140301651346fad90660e9d | train | function | @image_comparison(["auto_numticks_log.png"], style='default')
def test_auto_numticks_log():
# Verify that there are not too many ticks with a large log range.
fig, ax = plt.subplots()
matplotlib.rcParams['axes.autolimit_mode'] = 'round_numbers'
ax.loglog([1e-20, 1e5], [1e-16, 10])
| @image_comparison(["auto_numticks_log.png"], style='default')
def test_auto_numticks_log():
# Verify that there are not too many ticks with a large log range.
| fig, ax = plt.subplots()
matplotlib.rcParams['axes.autolimit_mode'] = 'round_numbers'
ax.loglog([1e-20, 1e5], [1e-16, 10])
| # Make tiny, empty subplots, verify that there are only 3 ticks.
plt.subplots(4, 4)
@image_comparison(["auto_numticks_log.png"], style='default')
def test_auto_numticks_log():
# Verify that there are not too many ticks with a large log range.
| 64 | 64 | 86 | 38 | 26 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_auto_numticks_log | test_auto_numticks_log | 5,768 | 5,773 | 5,768 | 5,770 | e7292e1b1c517ba268fedee882ecfae62e4bb7fe | bigcode/the-stack | train |
b1f96517622fdf691f8d3b94 | train | function | def test_clim():
ax = plt.figure().add_subplot()
for plot_method in [ax.imshow, ax.pcolor, ax.pcolormesh, ax.pcolorfast]:
clim = (7, 8)
norm = plot_method([[0, 1], [2, 3]], clim=clim).norm
assert (norm.vmin, norm.vmax) == clim
| def test_clim():
| ax = plt.figure().add_subplot()
for plot_method in [ax.imshow, ax.pcolor, ax.pcolormesh, ax.pcolorfast]:
clim = (7, 8)
norm = plot_method([[0, 1], [2, 3]], clim=clim).norm
assert (norm.vmin, norm.vmax) == clim
| ))
_, ax = plt.subplots()
line = ax.plot(x, y)
assert len(line) == 0
# Ensure plot([],[]) creates line
_, ax = plt.subplots()
line = ax.plot([], [])
assert len(line) == 1
def test_clim():
| 64 | 64 | 85 | 5 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_clim | test_clim | 7,257 | 7,262 | 7,257 | 7,257 | 89431d117bee7ebd3b5a7cc3b1a53de4d8323285 | bigcode/the-stack | train |
92d1157d992184992dbfda23 | train | function | def contour_dat():
x = np.linspace(-3, 5, 150)
y = np.linspace(-3, 5, 120)
z = np.cos(x) + np.sin(y[:, np.newaxis])
return x, y, z
| def contour_dat():
| x = np.linspace(-3, 5, 150)
y = np.linspace(-3, 5, 120)
z = np.cos(x) + np.sin(y[:, np.newaxis])
return x, y, z
| _stairs_datetime():
f, ax = plt.subplots(constrained_layout=True)
ax.stairs(np.arange(36),
np.arange(np.datetime64('2001-12-27'),
np.datetime64('2002-02-02')))
plt.xticks(rotation=30)
def contour_dat():
| 64 | 64 | 56 | 4 | 60 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | contour_dat | contour_dat | 2,048 | 2,052 | 2,048 | 2,048 | 28d7b56ffd3e71f988725d822bae075bbe14abfe | bigcode/the-stack | train |
258368ceba94236fedbba023 | train | function | @check_figures_equal(extensions=['png'])
def test_shared_axes_clear(fig_test, fig_ref):
x = np.arange(0.0, 2*np.pi, 0.01)
y = np.sin(x)
axs = fig_ref.subplots(2, 2, sharex=True, sharey=True)
for ax in axs.flat:
ax.plot(x, y)
axs = fig_test.subplots(2, 2, sharex=True, sharey=True)
... | @check_figures_equal(extensions=['png'])
def test_shared_axes_clear(fig_test, fig_ref):
| x = np.arange(0.0, 2*np.pi, 0.01)
y = np.sin(x)
axs = fig_ref.subplots(2, 2, sharex=True, sharey=True)
for ax in axs.flat:
ax.plot(x, y)
axs = fig_test.subplots(2, 2, sharex=True, sharey=True)
for ax in axs.flat:
ax.clear()
ax.plot(x, y)
| 3].hist(np.arange(10), color=color.reshape((1, -1)))
axs[4].bar(np.arange(10), np.arange(10), color=color.reshape((1, -1)))
@check_figures_equal(extensions=['png'])
def test_shared_axes_clear(fig_test, fig_ref):
| 63 | 64 | 120 | 21 | 42 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_shared_axes_clear | test_shared_axes_clear | 7,030 | 7,042 | 7,030 | 7,031 | 8257ebc3ee8689cadc8501249ab9cbf87c41b842 | bigcode/the-stack | train |
6bc1858b15b482eaf99c2e4c | train | function | def test_violinplot_bad_quantiles():
ax = plt.axes()
# First 9 digits of frac(sqrt(73))
np.random.seed(544003745)
data = [np.random.normal(size=100)]
# Different size quantile list and plots
with pytest.raises(ValueError):
ax.violinplot(data, quantiles=[[0.1, 0.2], [0.5, 0.7]])
... | def test_violinplot_bad_quantiles():
| ax = plt.axes()
# First 9 digits of frac(sqrt(73))
np.random.seed(544003745)
data = [np.random.normal(size=100)]
# Different size quantile list and plots
with pytest.raises(ValueError):
ax.violinplot(data, quantiles=[[0.1, 0.2], [0.5, 0.7]])
| .seed(280109889)
data = [np.random.normal(size=100) for _ in range(4)]
with pytest.raises(ValueError):
ax.violinplot(data, positions=range(4), widths=[1, 2, 3])
def test_violinplot_bad_quantiles():
| 63 | 64 | 96 | 9 | 54 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_violinplot_bad_quantiles | test_violinplot_bad_quantiles | 3,222 | 3,230 | 3,222 | 3,222 | 771d38e8f82b044d5b50a54d6cdc7d33dd2e886c | bigcode/the-stack | train |
9f6d3546515baaf3346e4692 | train | function | def test_minor_accountedfor():
with rc_context({'_internal.classic_mode': False}):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
fig.canvas.draw()
ax.tick_params(which='both', direction='out')
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
bbaxis, bbspines, bba... | def test_minor_accountedfor():
| with rc_context({'_internal.classic_mode': False}):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
fig.canvas.draw()
ax.tick_params(which='both', direction='out')
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
... | }):
fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
ax.tick_params(direction=dirs)
fig.canvas.draw()
bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
for nn, num in enumerate([0, 2]):
targetbb = mtransforms.Bbox.from_bounds(*targets[dn... | 118 | 118 | 394 | 7 | 111 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_minor_accountedfor | test_minor_accountedfor | 6,679 | 6,707 | 6,679 | 6,679 | a67a0983f80c963db4f6fee9c8fc12c7796778cb | bigcode/the-stack | train |
c8f76a56193c17949600dd8d | train | function | def test_bar_broadcast_args():
fig, ax = plt.subplots()
# Check that a bar chart with a single height for all bars works.
ax.bar(range(4), 1)
# Check that a horizontal chart with one width works.
ax.barh(0, 1, left=range(4), height=1)
# Check that edgecolor gets broadcast.
rect1, rect... | def test_bar_broadcast_args():
| fig, ax = plt.subplots()
# Check that a bar chart with a single height for all bars works.
ax.bar(range(4), 1)
# Check that a horizontal chart with one width works.
ax.barh(0, 1, left=range(4), height=1)
# Check that edgecolor gets broadcast.
rect1, rect2 = ax.bar([0, 1], [0, 1], edgec... | 5, 0.5)
ax.scatter(x, y, c=c_rgb)
ax.scatter(x, y, c=[c_rgb] * N)
def test_eventplot_legend():
plt.eventplot([1.0], label='Label')
plt.legend()
def test_bar_broadcast_args():
| 64 | 64 | 146 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_broadcast_args | test_bar_broadcast_args | 6,192 | 6,200 | 6,192 | 6,192 | 722af2edde6b942bc4d4633bf0c3ed612ac8d59d | bigcode/the-stack | train |
9e085a46cb5ca5a2fc04d0bb | train | function | def test_boxplot_marker_behavior():
plt.rcParams['lines.marker'] = 's'
plt.rcParams['boxplot.flierprops.marker'] = 'o'
plt.rcParams['boxplot.meanprops.marker'] = '^'
fig, ax = plt.subplots()
test_data = np.arange(100)
test_data[-1] = 150 # a flier point
bxp_handle = ax.boxplot(test_d... | def test_boxplot_marker_behavior():
| plt.rcParams['lines.marker'] = 's'
plt.rcParams['boxplot.flierprops.marker'] = 'o'
plt.rcParams['boxplot.meanprops.marker'] = '^'
fig, ax = plt.subplots()
test_data = np.arange(100)
test_data[-1] = 150 # a flier point
bxp_handle = ax.boxplot(test_data, showmeans=True)
for bxp_lin... | = np.arange(10)
fix, ax = plt.subplots()
assert ax.boxplot(x)['boxes'][0].get_zorder() == 2
assert ax.boxplot(x, zorder=10)['boxes'][0].get_zorder() == 10
def test_boxplot_marker_behavior():
| 64 | 64 | 205 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_marker_behavior | test_boxplot_marker_behavior | 3,026 | 3,041 | 3,026 | 3,026 | 3a6f7b591941781af19436c5ac86c148486640eb | bigcode/the-stack | train |
b6ab784b92fd13cbcdf31b94 | train | function | def test_multiplot_autoscale():
fig = plt.figure()
ax1, ax2 = fig.subplots(2, 1, sharex='all')
ax1.scatter([1, 2, 3, 4], [2, 3, 2, 3])
ax2.axhspan(-5, 5)
xlim = ax1.get_xlim()
assert np.allclose(xlim, [0.5, 4.5])
| def test_multiplot_autoscale():
| fig = plt.figure()
ax1, ax2 = fig.subplots(2, 1, sharex='all')
ax1.scatter([1, 2, 3, 4], [2, 3, 2, 3])
ax2.axhspan(-5, 5)
xlim = ax1.get_xlim()
assert np.allclose(xlim, [0.5, 4.5])
| ()
fig.canvas.draw()
for name, axis in zip(['x', 'y'], [ax.xaxis, ax.yaxis]):
for tick in axis.get_major_ticks():
assert tick.label1.get_size() == axis._get_tick_label_size(name)
def test_multiplot_autoscale():
| 64 | 64 | 102 | 9 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_multiplot_autoscale | test_multiplot_autoscale | 6,993 | 6,999 | 6,993 | 6,993 | 4fd5418a7b0504996e630c32ae544f70d21126b7 | bigcode/the-stack | train |
a372c11a32034b93abf85e29 | train | function | def test_unicode_hist_label():
fig, ax = plt.subplots()
a = (b'\xe5\xbe\x88\xe6\xbc\x82\xe4\xba\xae, ' +
b'r\xc3\xb6m\xc3\xa4n ch\xc3\xa4r\xc3\xa1ct\xc3\xa8rs')
b = b'\xd7\xa9\xd7\x9c\xd7\x95\xd7\x9d'
labels = [a.decode('utf-8'),
'hi aardvark',
b.decode('utf-8... | def test_unicode_hist_label():
| fig, ax = plt.subplots()
a = (b'\xe5\xbe\x88\xe6\xbc\x82\xe4\xba\xae, ' +
b'r\xc3\xb6m\xc3\xa4n ch\xc3\xa4r\xc3\xa1ct\xc3\xa8rs')
b = b'\xd7\xa9\xd7\x9c\xd7\x95\xd7\x9d'
labels = [a.decode('utf-8'),
'hi aardvark',
b.decode('utf-8'),
]
ax.h... | , 1], c='lime')[0]
assert 'lime' == line.get_color()
def test_numerical_hist_label():
fig, ax = plt.subplots()
ax.hist([range(15)] * 5, label=range(5))
ax.legend()
def test_unicode_hist_label():
| 64 | 64 | 144 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_unicode_hist_label | test_unicode_hist_label | 5,354 | 5,365 | 5,354 | 5,354 | 42f941830cb324ab09483b1481f32074cc898e8b | bigcode/the-stack | train |
c31ab57c311d433945e468ce | train | function | @image_comparison(['fill_units.png'], savefig_kwarg={'dpi': 60})
def test_fill_units():
import matplotlib.testing.jpl_units as units
units.register()
# generate some data
t = units.Epoch("ET", dt=datetime.datetime(2009, 4, 27))
value = 10.0 * units.deg
day = units.Duration("ET", 24.0 * ... | @image_comparison(['fill_units.png'], savefig_kwarg={'dpi': 60})
def test_fill_units():
| import matplotlib.testing.jpl_units as units
units.register()
# generate some data
t = units.Epoch("ET", dt=datetime.datetime(2009, 4, 27))
value = 10.0 * units.deg
day = units.Duration("ET", 24.0 * 60.0 * 60.0)
dt = np.arange('2009-04-27', '2009-04-29', dtype='datetime64[D]')
d... | 8, 2.2)
def test_annotate_default_arrow():
# Check that we can make an annotation arrow with only default properties.
fig, ax = plt.subplots()
ann = ax.annotate("foo", (0, 1), xytext=(2, 3))
assert ann.arrow_patch is None
ann = ax.annotate("foo", (0, 1), xytext=(2, 3), arrowprops={})
... | 129 | 129 | 430 | 24 | 104 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_fill_units | test_fill_units | 587 | 618 | 587 | 588 | c7989cbc26a1746912a7bdfa8042ca061b820495 | bigcode/the-stack | train |
65125baa97be6b23bcee7ec0 | train | function | @image_comparison(['vline_hline_zorder', 'errorbar_zorder'],
tol=0 if platform.machine() == 'x86_64' else 0.02)
def test_eb_line_zorder():
x = list(range(10))
# First illustrate basic pyplot interface, using defaults where possible.
fig = plt.figure()
ax = fig.gca()
ax.plo... | @image_comparison(['vline_hline_zorder', 'errorbar_zorder'],
tol=0 if platform.machine() == 'x86_64' else 0.02)
def test_eb_line_zorder():
| x = list(range(10))
# First illustrate basic pyplot interface, using defaults where possible.
fig = plt.figure()
ax = fig.gca()
ax.plot(x, lw=10, zorder=5)
ax.axhline(1, color='red', lw=10, zorder=1)
ax.axhline(5, color='green', lw=10, zorder=10)
ax.axvline(7, color='m', lw=10, ... | marker=marker_as_tuple, mfc='k')
ax.plot(data[::-1], linestyle='', marker=marker_as_list, mfc='b')
ax.set_xlim([-1, 10])
ax.set_ylim([-1, 10])
@image_comparison(['vline_hline_zorder', 'errorbar_zorder'],
tol=0 if platform.machine() == 'x86_64' else 0.02)
def test_eb_line_zorder():
| 98 | 99 | 331 | 47 | 51 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_eb_line_zorder | test_eb_line_zorder | 4,165 | 4,192 | 4,165 | 4,167 | 2d87b7312befe83b498e1967b0ec90f32051c5c6 | bigcode/the-stack | train |
bc4e2a56cf9ea4c989770dbc | train | function | @check_figures_equal(extensions=["png"])
def test_spy(fig_test, fig_ref):
np.random.seed(19680801)
a = np.ones(32 * 32)
a[:16 * 32] = 0
np.random.shuffle(a)
a = a.reshape((32, 32))
axs_test = fig_test.subplots(2)
axs_test[0].spy(a)
axs_test[1].spy(a, marker=".", origin="lower"... | @check_figures_equal(extensions=["png"])
def test_spy(fig_test, fig_ref):
| np.random.seed(19680801)
a = np.ones(32 * 32)
a[:16 * 32] = 0
np.random.shuffle(a)
a = a.reshape((32, 32))
axs_test = fig_test.subplots(2)
axs_test[0].spy(a)
axs_test[1].spy(a, marker=".", origin="lower")
axs_ref = fig_ref.subplots(2)
axs_ref[0].imshow(a, cmap="gray_... | [Nx-1-maxlags:Nx+maxlags]
ax_ref.vlines(lags, [0], norm_auto_corr)
ax_ref.axhline(y=0, xmin=0, xmax=1)
@check_figures_equal(extensions=["png"])
def test_spy(fig_test, fig_ref):
| 66 | 66 | 220 | 21 | 45 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_spy | test_spy | 126 | 145 | 126 | 127 | 30c4b84cc445eb078167bf1af759034064438ee5 | bigcode/the-stack | train |
db08fc3f23169706794be0d1 | train | function | def test_tick_space_size_0():
# allow font size to be zero, which affects ticks when there is
# no other text in the figure.
plt.plot([0, 1], [0, 1])
matplotlib.rcParams.update({'font.size': 0})
b = io.BytesIO()
plt.savefig(b, dpi=80, format='raw')
| def test_tick_space_size_0():
# allow font size to be zero, which affects ticks when there is
# no other text in the figure.
| plt.plot([0, 1], [0, 1])
matplotlib.rcParams.update({'font.size': 0})
b = io.BytesIO()
plt.savefig(b, dpi=80, format='raw')
| ()) == [3, 5]
assert [t.get_text() for t in ax.get_xticklabels()] == ["3", "5"]
def test_tick_space_size_0():
# allow font size to be zero, which affects ticks when there is
# no other text in the figure.
| 63 | 64 | 80 | 33 | 30 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_tick_space_size_0 | test_tick_space_size_0 | 3,296 | 3,302 | 3,296 | 3,298 | 857c47de3d0bfd5c663f6e2b8ab4013d9b2d3f2d | bigcode/the-stack | train |
664f7a8e42750c2050513618 | train | function | @image_comparison(['hist_stacked_normed'])
def test_hist_stacked_density():
# make some data
d1 = np.linspace(1, 3, 20)
d2 = np.linspace(0, 10, 50)
fig, ax = plt.subplots()
ax.hist((d1, d2), stacked=True, density=True)
| @image_comparison(['hist_stacked_normed'])
def test_hist_stacked_density():
# make some data
| d1 = np.linspace(1, 3, 20)
d2 = np.linspace(0, 10, 50)
fig, ax = plt.subplots()
ax.hist((d1, d2), stacked=True, density=True)
| d2 = np.linspace(0, 10, 50)
fig, ax = plt.subplots()
ax.hist((d1, d2), histtype="step", stacked=True)
@image_comparison(['hist_stacked_normed'])
def test_hist_stacked_density():
# make some data
| 64 | 64 | 78 | 24 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_stacked_density | test_hist_stacked_density | 3,688 | 3,694 | 3,688 | 3,690 | c4991f5afb4cad66869ee75761dd6c4cf4d86d00 | bigcode/the-stack | train |
015be76ef17d1e708517e695 | train | function | def test_empty_ticks_fixed_loc():
# Smoke test that [] can be used to unset all tick labels
fig, ax = plt.subplots()
ax.bar([1, 2], [1, 2])
ax.set_xticks([1, 2])
ax.set_xticklabels([])
| def test_empty_ticks_fixed_loc():
# Smoke test that [] can be used to unset all tick labels
| fig, ax = plt.subplots()
ax.bar([1, 2], [1, 2])
ax.set_xticks([1, 2])
ax.set_xticklabels([])
| 10))
ax.xaxis.set_ticks([1.5, 2.5])
with pytest.raises(ValueError):
ax.xaxis.set_ticklabels(['a', 'b', 'c'])
def test_empty_ticks_fixed_loc():
# Smoke test that [] can be used to unset all tick labels
| 63 | 64 | 63 | 22 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_empty_ticks_fixed_loc | test_empty_ticks_fixed_loc | 5,231 | 5,236 | 5,231 | 5,232 | 41325a979c874d8b8dc99fd4d36262109b0b964d | bigcode/the-stack | train |
7672b7c01aedf87fd4b0c7d5 | train | function | @check_figures_equal()
def test_label_loc_horizontal(fig_test, fig_ref):
ax = fig_test.subplots()
sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
ax.legend()
ax.set_ylabel('Y Label', loc='bottom')
ax.set_xlabel('X Label', loc='left')
cbar = fig_test.colorbar(sc, orientation='ho... | @check_figures_equal()
def test_label_loc_horizontal(fig_test, fig_ref):
| ax = fig_test.subplots()
sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
ax.legend()
ax.set_ylabel('Y Label', loc='bottom')
ax.set_xlabel('X Label', loc='left')
cbar = fig_test.colorbar(sc, orientation='horizontal')
cbar.set_label("Z Label", loc='left')
ax = fig_ref.s... | ='right')
ax.set_xlabel('X Label', x=1, ha='right')
cbar = fig_ref.colorbar(sc)
cbar.set_label("Z Label", y=1, ha='right')
@check_figures_equal()
def test_label_loc_horizontal(fig_test, fig_ref):
| 63 | 64 | 209 | 17 | 46 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_label_loc_horizontal | test_label_loc_horizontal | 67 | 83 | 67 | 68 | 3fbf8f5a5e73c4a6fb8d2b24f53344440e531796 | bigcode/the-stack | train |
e39d85c87bbb59a36cf9fd75 | train | function | @image_comparison(['pcolor_datetime_axis.png'],
remove_text=False, style='mpl20')
def test_pcolor_datetime_axis():
fig = plt.figure()
fig.subplots_adjust(hspace=0.4, top=0.98, bottom=.15)
base = datetime.datetime(2013, 1, 1)
x = np.array([base + datetime.timedelta(days=d) for d i... | @image_comparison(['pcolor_datetime_axis.png'],
remove_text=False, style='mpl20')
def test_pcolor_datetime_axis():
| fig = plt.figure()
fig.subplots_adjust(hspace=0.4, top=0.98, bottom=.15)
base = datetime.datetime(2013, 1, 1)
x = np.array([base + datetime.timedelta(days=d) for d in range(21)])
y = np.arange(21)
z1, z2 = np.meshgrid(np.arange(20), np.arange(20))
z = z1 * z2
plt.subplot(221)
... | [:-1, :-1])
plt.subplot(224)
plt.pcolormesh(x, y, z)
for ax in fig.get_axes():
for label in ax.get_xticklabels():
label.set_ha('right')
label.set_rotation(30)
@image_comparison(['pcolor_datetime_axis.png'],
remove_text=False, style='mpl20')
def test_... | 84 | 84 | 283 | 28 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pcolor_datetime_axis | test_pcolor_datetime_axis | 1,151 | 1,174 | 1,151 | 1,153 | 02d166dc5441c82bb5abe21785adf81fd2db7b0a | bigcode/the-stack | train |
1e0cebacb026e59abd249806 | train | function | def test_subplot_key_hash():
ax = plt.subplot(np.int32(5), np.int64(1), 1)
ax.twinx()
assert ax.get_subplotspec().get_geometry() == (5, 1, 0, 0)
| def test_subplot_key_hash():
| ax = plt.subplot(np.int32(5), np.int64(1), 1)
ax.twinx()
assert ax.get_subplotspec().get_geometry() == (5, 1, 0, 0)
| 0, 0.1, 0.5]])
ax.patch.set_color('0.5')
ax.add_collection(p1)
ax.add_collection(p2)
ax.set_xlim(0, 16)
ax.set_ylim(0, 16)
def test_subplot_key_hash():
| 64 | 64 | 56 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_subplot_key_hash | test_subplot_key_hash | 4,456 | 4,459 | 4,456 | 4,456 | 4ef3fca38f2f614ee9b98511a8f5aa3e18b82b49 | bigcode/the-stack | train |
10da44b6b96c5abe1d2190f8 | train | function | @image_comparison(['symlog.pdf'])
def test_symlog():
x = np.array([0, 1, 2, 4, 6, 9, 12, 24])
y = np.array([1000000, 500000, 100000, 100, 5, 0, 0, 0])
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_yscale('symlog')
ax.set_xscale('linear')
ax.set_ylim(-1, 10000000)
| @image_comparison(['symlog.pdf'])
def test_symlog():
| x = np.array([0, 1, 2, 4, 6, 9, 12, 24])
y = np.array([1000000, 500000, 100000, 100, 5, 0, 0, 0])
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_yscale('symlog')
ax.set_xscale('linear')
ax.set_ylim(-1, 10000000)
| .5)
# test_symlog and test_symlog2 used to have baseline images in all three
# formats, but the png and svg baselines got invalidated by the removal of
# minor tick overstriking.
@image_comparison(['symlog.pdf'])
def test_symlog():
| 64 | 64 | 124 | 16 | 48 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_symlog | test_symlog | 1,024 | 1,033 | 1,024 | 1,025 | 741ac5bbd59c28ab2f8387e7d128ac57394c8b76 | bigcode/the-stack | train |
2e889858ed45f23c5de3d5f1 | train | function | @check_figures_equal(extensions=["png"])
def test_shaped_data(fig_test, fig_ref):
row = np.arange(10).reshape((1, -1))
col = np.arange(0, 100, 10).reshape((-1, 1))
axs = fig_test.subplots(2)
axs[0].plot(row) # Actually plots nothing (columns are single points).
axs[1].plot(col) # Same as p... | @check_figures_equal(extensions=["png"])
def test_shaped_data(fig_test, fig_ref):
| row = np.arange(10).reshape((1, -1))
col = np.arange(0, 100, 10).reshape((-1, 1))
axs = fig_test.subplots(2)
axs[0].plot(row) # Actually plots nothing (columns are single points).
axs[1].plot(col) # Same as plotting 1d.
axs = fig_ref.subplots(2)
# xlim from the implicit "x=0", yl... | ax[0].plot_date(time1 + dt, data1, 'o', color='r')
ax[1].plot(time1, data1, 'o', color='r')
@check_figures_equal(extensions=["png"])
def test_shaped_data(fig_test, fig_ref):
| 63 | 64 | 163 | 22 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_shaped_data | test_shaped_data | 665 | 677 | 665 | 666 | 45ca0cc77f5c05881fae9f308ee907c544eb7cb1 | bigcode/the-stack | train |
8dfd5b4f35171883dc121da1 | train | function | @image_comparison(['boxplot_mod_artists_after_plotting.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_mod_artist_after_plotting():
x = [0.15, 0.11, 0.06, 0.06, 0.12, 0.56, -0.56]
fig, ax = plt.subplots()
bp = ax.boxplot(x, sym="o")
for key i... | @image_comparison(['boxplot_mod_artists_after_plotting.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_mod_artist_after_plotting():
| x = [0.15, 0.11, 0.06, 0.06, 0.12, 0.56, -0.56]
fig, ax = plt.subplots()
bp = ax.boxplot(x, sym="o")
for key in bp:
for obj in bp[key]:
obj.set_color('green')
| 'o'
assert bxp_handle['means'][0].get_marker() == '^'
@image_comparison(['boxplot_mod_artists_after_plotting.png'],
remove_text=True, savefig_kwarg={'dpi': 40}, style='default')
def test_boxplot_mod_artist_after_plotting():
| 63 | 64 | 122 | 44 | 19 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_boxplot_mod_artist_after_plotting | test_boxplot_mod_artist_after_plotting | 3,044 | 3,052 | 3,044 | 3,046 | 26a670f83c33801a332b401a9907bdc3bcb93ca0 | bigcode/the-stack | train |
db6c10830e4e183628ec8d82 | train | function | def test_pandas_pcolormesh(pd):
time = 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_pcolormesh(pd):
| time = 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)
| assert pp.get_paths()[0].vertices[0, 0] == mdates.date2num(d0)
assert pp.get_paths()[0].vertices[2, 0] == mdates.date2num(d0) + 1 / 24
def test_pandas_pcolormesh(pd):
| 64 | 64 | 68 | 10 | 53 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pandas_pcolormesh | test_pandas_pcolormesh | 5,790 | 5,796 | 5,790 | 5,790 | d6234fc7d6150a13a5b9619dcf78fcb0e3310ff9 | bigcode/the-stack | train |
640620057dfa1d0ee68c5411 | train | function | def test_pcolor_regression(pd):
from pandas.plotting import (
register_matplotlib_converters,
deregister_matplotlib_converters,
)
fig = plt.figure()
ax = fig.add_subplot(111)
times = [datetime.datetime(2021, 1, 1)]
while len(times) < 7:
times.append(times[-1]... | def test_pcolor_regression(pd):
| from pandas.plotting import (
register_matplotlib_converters,
deregister_matplotlib_converters,
)
fig = plt.figure()
ax = fig.add_subplot(111)
times = [datetime.datetime(2021, 1, 1)]
while len(times) < 7:
times.append(times[-1] + datetime.timedelta(seconds=120... | data = np.random.rand(5, 2)
years = pd.date_range('1/1/2000',
periods=2, freq=pd.DateOffset(years=1)).year
plt.figure()
plt.boxplot(data, positions=years)
def test_pcolor_regression(pd):
| 64 | 64 | 203 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_pcolor_regression | test_pcolor_regression | 1,655 | 1,682 | 1,655 | 1,655 | 20e6285be9e28ae6463a5a3f827fcdaf4874a2c8 | bigcode/the-stack | train |
11a7445c767594678477a98a | train | function | def test_bar_errbar_zorder():
# Check that the zorder of errorbars is always greater than the bar they
# are plotted on
fig, ax = plt.subplots()
x = [1, 2, 3]
barcont = ax.bar(x=x, height=x, yerr=x, capsize=5, zorder=3)
data_line, caplines, barlinecols = barcont.errorbar.lines
for b... | def test_bar_errbar_zorder():
# Check that the zorder of errorbars is always greater than the bar they
# are plotted on
| fig, ax = plt.subplots()
x = [1, 2, 3]
barcont = ax.bar(x=x, height=x, yerr=x, capsize=5, zorder=3)
data_line, caplines, barlinecols = barcont.errorbar.lines
for bar in barcont.patches:
for capline in caplines:
assert capline.zorder > bar.zorder
for barlinecol in... | ",
range=(0, 1), density=True)
assert bins[0] == 0
assert bins[-1] == 1
def test_bar_errbar_zorder():
# Check that the zorder of errorbars is always greater than the bar they
# are plotted on
| 64 | 64 | 145 | 32 | 31 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_errbar_zorder | test_bar_errbar_zorder | 6,778 | 6,790 | 6,778 | 6,780 | 3f2faef0ab2ae925f94c0937960efd35aad679ba | bigcode/the-stack | train |
31324a274a2dc8dfb80dcb4f | train | function | def test_stairs_invalid_update2():
h = plt.stairs([1, 2], [0, 1, 2])
with pytest.raises(ValueError, match='Size mismatch'):
h.set_data(edges=np.arange(5))
| def test_stairs_invalid_update2():
| h = plt.stairs([1, 2], [0, 1, 2])
with pytest.raises(ValueError, match='Size mismatch'):
h.set_data(edges=np.arange(5))
| airs_invalid_update():
h = plt.stairs([1, 2], [0, 1, 2])
with pytest.raises(ValueError, match='Nan values in "edges"'):
h.set_data(edges=[1, np.nan, 2])
def test_stairs_invalid_update2():
| 63 | 64 | 51 | 8 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stairs_invalid_update2 | test_stairs_invalid_update2 | 2,009 | 2,012 | 2,009 | 2,009 | 57fa115b45d8f5241296d14b2c35ff4d099ad925 | bigcode/the-stack | train |
a3c4f0c6ca99218b91de6c9b | train | function | def test_normalize_kwarg_pie():
fig, ax = plt.subplots()
x = [0.3, 0.3, 0.1]
t1 = ax.pie(x=x, normalize=True)
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
| def test_normalize_kwarg_pie():
| fig, ax = plt.subplots()
x = [0.3, 0.3, 0.1]
t1 = ax.pie(x=x, normalize=True)
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
| # 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_normalize_kwarg_pie():
| 63 | 64 | 107 | 9 | 54 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_normalize_kwarg_pie | test_normalize_kwarg_pie | 5,154 | 5,160 | 5,154 | 5,154 | da91c270960716280619c373f1af3403dfff5741 | bigcode/the-stack | train |
96a54d16ad3273c5238b659d | train | function | @image_comparison(['hist_step_horiz.png'])
def test_hist_step_horiz():
# make some data
d1 = np.linspace(0, 10, 50)
d2 = np.linspace(1, 3, 20)
fig, ax = plt.subplots()
ax.hist((d1, d2), histtype="step", orientation="horizontal")
| @image_comparison(['hist_step_horiz.png'])
def test_hist_step_horiz():
# make some data
| d1 = np.linspace(0, 10, 50)
d2 = np.linspace(1, 3, 20)
fig, ax = plt.subplots()
ax.hist((d1, d2), histtype="step", orientation="horizontal")
| )
fig, ax = plt.subplots()
ax.hist(d1, histtype="step")
ax.set_ylim(0, 10)
ax.set_xlim(-1, 5)
@image_comparison(['hist_step_horiz.png'])
def test_hist_step_horiz():
# make some data
| 64 | 64 | 81 | 24 | 40 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_step_horiz | test_hist_step_horiz | 3,602 | 3,608 | 3,602 | 3,604 | e2d397531fd9bcb3ab595159fde25337d989b2cf | bigcode/the-stack | train |
21b99a9ca54e4a999defdbfe | train | function | @mpl.style.context('default')
def test_autoscale_tiny_sticky():
fig, ax = plt.subplots()
ax.bar(0, 1e-9)
fig.canvas.draw()
assert ax.get_ylim() == (0, 1.05e-9)
| @mpl.style.context('default')
def test_autoscale_tiny_sticky():
| fig, ax = plt.subplots()
ax.bar(0, 1e-9)
fig.canvas.draw()
assert ax.get_ylim() == (0, 1.05e-9)
| ()._interpolation_steps = 100
fig_ref.add_subplot(projection="polar").plot(
np.linspace(0, np.pi/2, 101), np.linspace(1, 2, 101))
@mpl.style.context('default')
def test_autoscale_tiny_sticky():
| 63 | 64 | 60 | 17 | 46 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_autoscale_tiny_sticky | test_autoscale_tiny_sticky | 6,951 | 6,956 | 6,951 | 6,952 | ab73986a5c2b8ed2709f743282e4301dee0908d6 | bigcode/the-stack | train |
f8ba699a65dcd9c597f343f8 | train | function | def test_rc_tick():
d = {'xtick.bottom': False, 'xtick.top': True,
'ytick.left': True, 'ytick.right': False}
with plt.rc_context(rc=d):
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
xax = ax1.xaxis
yax = ax1.yaxis
# tick1On bottom/left
assert... | def test_rc_tick():
| d = {'xtick.bottom': False, 'xtick.top': True,
'ytick.left': True, 'ytick.right': False}
with plt.rc_context(rc=d):
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
xax = ax1.xaxis
yax = ax1.yaxis
# tick1On bottom/left
assert not xax._major_tick_... | .grid.axis': 'y'
}
dict_list = [rc_dict0, rc_dict1, rc_dict2]
for i, rc_dict in enumerate(dict_list, 1):
with matplotlib.rc_context(rc_dict):
fig.add_subplot(3, 1, i)
def test_rc_tick():
| 64 | 64 | 198 | 5 | 59 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_rc_tick | test_rc_tick | 5,427 | 5,444 | 5,427 | 5,427 | 4d2242336ab000e88b93a390a77442ce5a336839 | bigcode/the-stack | train |
79860fb4b980b8fdfc305537 | train | function | def test_stem_args():
fig, ax = plt.subplots()
x = list(range(10))
y = list(range(10))
# Test the call signatures
ax.stem(y)
ax.stem(x, y)
ax.stem(x, y, linefmt='r--')
ax.stem(x, y, linefmt='r--', basefmt='b--')
| def test_stem_args():
| fig, ax = plt.subplots()
x = list(range(10))
y = list(range(10))
# Test the call signatures
ax.stem(y)
ax.stem(x, y)
ax.stem(x, y, linefmt='r--')
ax.stem(x, y, linefmt='r--', basefmt='b--')
| but to avoid any
# text being drawn
ax.stem(x, np.cos(x),
linefmt='C2-.', markerfmt='k+', basefmt='C1-.', label=' ',
use_line_collection=use_line_collection)
ax.legend()
def test_stem_args():
| 64 | 64 | 85 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stem_args | test_stem_args | 3,637 | 3,647 | 3,637 | 3,637 | 5e04bac8cb7f3fd8930cdaf8261aaa1f2640a889 | bigcode/the-stack | train |
e08d054397698d609f54a8d9 | train | function | @check_figures_equal()
def test_axline(fig_test, fig_ref):
ax = fig_test.subplots()
ax.set(xlim=(-1, 1), ylim=(-1, 1))
ax.axline((0, 0), (1, 1))
ax.axline((0, 0), (1, 0), color='C1')
ax.axline((0, 0.5), (1, 0.5), color='C2')
# slopes
ax.axline((-0.7, -0.5), slope=0, color='C3')
... | @check_figures_equal()
def test_axline(fig_test, fig_ref):
| ax = fig_test.subplots()
ax.set(xlim=(-1, 1), ylim=(-1, 1))
ax.axline((0, 0), (1, 1))
ax.axline((0, 0), (1, 0), color='C1')
ax.axline((0, 0.5), (1, 0.5), color='C2')
# slopes
ax.axline((-0.7, -0.5), slope=0, color='C3')
ax.axline((1, -0.5), slope=-0.5, color='C4')
ax.axline((... | fig_ref.subplots()
ax.set(xlim=(0.1, 10), ylim=(1e-3, 1))
ax.loglog([.3, .6], [.3, .6], ".-")
ax.loglog([1, 10], [1e-3, 1e-2], c="k")
@check_figures_equal()
def test_axline(fig_test, fig_ref):
| 89 | 90 | 301 | 16 | 73 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axline | test_axline | 4,208 | 4,228 | 4,208 | 4,209 | e6a6b8af8d2b09c305fe416fadc8372c19c90dd2 | bigcode/the-stack | train |
b1197d56c07685415a2e136e | train | function | @image_comparison(['date_timezone_y.png'])
def test_date_timezone_y():
# 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=... | @image_comparison(['date_timezone_y.png'])
def test_date_timezone_y():
# 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([3] * 3,
time_index, tz... | /Eastern')
# Different Timezone
plt.subplot(2, 1, 2)
plt.plot_date(time_index, [3] * 3, tz='UTC')
@image_comparison(['date_timezone_y.png'])
def test_date_timezone_y():
# Tests issue 5575
| 63 | 64 | 168 | 24 | 39 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_date_timezone_y | test_date_timezone_y | 5,947 | 5,962 | 5,947 | 5,949 | f95cefc2c11e6142d0b93d3c71d76ed9840a0d1d | bigcode/the-stack | train |
7f3ea1510d528b9fd740b2b3 | train | function | @pytest.mark.parametrize('size', [size for size in mfont_manager.font_scalings
if size is not None] + [8, 10, 12])
@mpl.style.context('default')
def test_relative_ticklabel_sizes(size):
mpl.rcParams['xtick.labelsize'] = size
mpl.rcParams['ytick.labelsize'] = size
fig,... | @pytest.mark.parametrize('size', [size for size in mfont_manager.font_scalings
if size is not None] + [8, 10, 12])
@mpl.style.context('default')
def test_relative_ticklabel_sizes(size):
| mpl.rcParams['xtick.labelsize'] = size
mpl.rcParams['ytick.labelsize'] = size
fig, ax = plt.subplots()
fig.canvas.draw()
for name, axis in zip(['x', 'y'], [ax.xaxis, ax.yaxis]):
for tick in axis.get_major_ticks():
assert tick.label1.get_size() == axis._get_tick_label_size... | '
assert tick.label1.get_color() == 'blue'
@pytest.mark.parametrize('size', [size for size in mfont_manager.font_scalings
if size is not None] + [8, 10, 12])
@mpl.style.context('default')
def test_relative_ticklabel_sizes(size):
| 63 | 64 | 138 | 50 | 13 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_relative_ticklabel_sizes | test_relative_ticklabel_sizes | 6,979 | 6,990 | 6,979 | 6,982 | cf057eec342eca664e7665702f1ee7c8b2e903e6 | bigcode/the-stack | train |
38e1fc97e65cb33d7afc9597 | train | function | @pytest.mark.parametrize('fv, fh, args', [[plt.axvline, plt.axhline, (1,)],
[plt.axvspan, plt.axhspan, (1, 1)]])
def test_axline_minmax(fv, fh, args):
bad_lim = matplotlib.dates.num2date(1)
# Check vertical functions
with pytest.raises(ValueError, match='ymin m... | @pytest.mark.parametrize('fv, fh, args', [[plt.axvline, plt.axhline, (1,)],
[plt.axvspan, plt.axhspan, (1, 1)]])
def test_axline_minmax(fv, fh, args):
| bad_lim = matplotlib.dates.num2date(1)
# Check vertical functions
with pytest.raises(ValueError, match='ymin must be a single scalar value'):
fv(*args, ymin=bad_lim, ymax=1)
with pytest.raises(ValueError, match='ymax must be a single scalar value'):
fv(*args, ymin=1, ymax=bad_lim)
... | 1, .2))
@pytest.mark.parametrize('fv, fh, args', [[plt.axvline, plt.axhline, (1,)],
[plt.axvspan, plt.axhspan, (1, 1)]])
def test_axline_minmax(fv, fh, args):
| 63 | 64 | 210 | 58 | 5 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_axline_minmax | test_axline_minmax | 4,856 | 4,869 | 4,856 | 4,858 | acceebc96956c782ffba861b8d6cf3e450ef3e55 | bigcode/the-stack | train |
904a9e764c15d194ad07793d | train | function | @image_comparison(['bxp_nocaps.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_nocaps():
_bxp_test_helper(bxp_kwargs=dict(showcaps=False))
| @image_comparison(['bxp_nocaps.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_nocaps():
| _bxp_test_helper(bxp_kwargs=dict(showcaps=False))
| xp_shownotches():
_bxp_test_helper(bxp_kwargs=dict(shownotches=True))
@image_comparison(['bxp_nocaps.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_nocaps():
| 63 | 64 | 55 | 41 | 22 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_nocaps | test_bxp_nocaps | 2,749 | 2,754 | 2,749 | 2,753 | 26715b04238f255053b5c40593883cb6a5939b91 | bigcode/the-stack | train |
57bac6ce71cca1d7f46ff361 | train | function | @image_comparison(['offset_points'], remove_text=True)
def test_basic_annotate():
# Setup some data
t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2.0*np.pi * t)
# Offset Points
fig = plt.figure()
ax = fig.add_subplot(autoscale_on=False, xlim=(-1, 5), ylim=(-3, 5))
line, = ax.plot(t, s... | @image_comparison(['offset_points'], remove_text=True)
def test_basic_annotate():
# Setup some data
| t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2.0*np.pi * t)
# Offset Points
fig = plt.figure()
ax = fig.add_subplot(autoscale_on=False, xlim=(-1, 5), ylim=(-3, 5))
line, = ax.plot(t, s, lw=3, color='purple')
ax.annotate('local max', xy=(3, 1), xycoords='data',
xytext... | esh(Z)
ax0 = fig_ref.add_subplot(212)
ax1 = fig_ref.add_subplot(211, sharex=ax0)
ax0.pcolormesh(Z)
@image_comparison(['offset_points'], remove_text=True)
def test_basic_annotate():
# Setup some data
| 64 | 64 | 150 | 25 | 39 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_basic_annotate | test_basic_annotate | 522 | 535 | 522 | 524 | 3e9ef3f8ba5e35977dbb39d0a3a3bc1d71318a35 | bigcode/the-stack | train |
04389386398668b361cc3c3d | train | function | def test_bxp_bad_positions():
with pytest.raises(ValueError):
_bxp_test_helper(bxp_kwargs=dict(positions=[2, 3]))
| def test_bxp_bad_positions():
| with pytest.raises(ValueError):
_bxp_test_helper(bxp_kwargs=dict(positions=[2, 3]))
| ():
_bxp_test_helper(bxp_kwargs=dict(positions=[1, 5, 6, 7]))
def test_bxp_bad_widths():
with pytest.raises(ValueError):
_bxp_test_helper(bxp_kwargs=dict(widths=[1]))
def test_bxp_bad_positions():
| 63 | 64 | 32 | 7 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_bad_positions | test_bxp_bad_positions | 2,824 | 2,826 | 2,824 | 2,824 | 89dcf5f39c34936930e10846e12e3386bd1a7f6a | bigcode/the-stack | train |
e299b45c5e3a7e15cb93aa6d | train | function | def test_box_aspect_custom_position():
# Test if axes with custom position and box_aspect
# behaves the same independent of the order of setting those.
fig1, ax1 = plt.subplots()
ax1.set_position([0.1, 0.1, 0.9, 0.2])
fig1.canvas.draw()
ax1.set_box_aspect(1.)
fig2, ax2 = plt.subpl... | def test_box_aspect_custom_position():
# Test if axes with custom position and box_aspect
# behaves the same independent of the order of setting those.
| fig1, ax1 = plt.subplots()
ax1.set_position([0.1, 0.1, 0.9, 0.2])
fig1.canvas.draw()
ax1.set_box_aspect(1.)
fig2, ax2 = plt.subplots()
ax2.set_box_aspect(1.)
fig2.canvas.draw()
ax2.set_position([0.1, 0.1, 0.9, 0.2])
fig1.canvas.draw()
fig2.canvas.draw()
bb1 = ... | _position()
assert_array_equal(bb1.extents, bb2.extents)
assert_array_equal(bbt.extents, bb2.extents)
def test_box_aspect_custom_position():
# Test if axes with custom position and box_aspect
# behaves the same independent of the order of setting those.
| 64 | 64 | 182 | 34 | 30 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_box_aspect_custom_position | test_box_aspect_custom_position | 6,854 | 6,874 | 6,854 | 6,857 | ac4a6a7533b5aea9e8e434eb98ec5397d702d4b1 | bigcode/the-stack | train |
3983392bf27aa6f2a13376d8 | train | function | @image_comparison(['hist_bar_empty.png'], remove_text=True)
def test_hist_bar_empty():
# From #3886: creating hist from empty dataset raises ValueError
ax = plt.gca()
ax.hist([], histtype='bar')
| @image_comparison(['hist_bar_empty.png'], remove_text=True)
def test_hist_bar_empty():
# From #3886: creating hist from empty dataset raises ValueError
| ax = plt.gca()
ax.hist([], histtype='bar')
| _yscale("log")
fig.canvas.draw()
assert axs[0].get_ylim() == axs[1].get_ylim()
@image_comparison(['hist_bar_empty.png'], remove_text=True)
def test_hist_bar_empty():
# From #3886: creating hist from empty dataset raises ValueError
| 64 | 64 | 52 | 36 | 28 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_bar_empty | test_hist_bar_empty | 1,770 | 1,774 | 1,770 | 1,772 | 67fcfc6552197fbb325de0d32615911b29f01f9d | bigcode/the-stack | train |
d9bbdc44962227f8cefbd82e | train | function | def test_stem_dates():
fig, ax = plt.subplots(1, 1)
xs = [dateutil.parser.parse("2013-9-28 11:00:00"),
dateutil.parser.parse("2013-9-28 12:00:00")]
ys = [100, 200]
ax.stem(xs, ys)
| def test_stem_dates():
| fig, ax = plt.subplots(1, 1)
xs = [dateutil.parser.parse("2013-9-28 11:00:00"),
dateutil.parser.parse("2013-9-28 12:00:00")]
ys = [100, 200]
ax.stem(xs, ys)
| 10))
# Test the call signatures
ax.stem(y)
ax.stem(x, y)
ax.stem(x, y, linefmt='r--')
ax.stem(x, y, linefmt='r--', basefmt='b--')
def test_stem_dates():
| 63 | 64 | 77 | 6 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stem_dates | test_stem_dates | 3,650 | 3,655 | 3,650 | 3,650 | ec8bb4aaa7fc8dab6ef068e53614249247c2826c | bigcode/the-stack | train |
d80a8880ffd832f81349a2a1 | train | function | def test_funcformatter_auto_formatter():
def _formfunc(x, pos):
return ''
ax = plt.figure().subplots()
assert ax.xaxis.isDefault_majfmt
assert ax.xaxis.isDefault_minfmt
assert ax.yaxis.isDefault_majfmt
assert ax.yaxis.isDefault_minfmt
ax.xaxis.set_major_formatter(_formf... | def test_funcformatter_auto_formatter():
| def _formfunc(x, pos):
return ''
ax = plt.figure().subplots()
assert ax.xaxis.isDefault_majfmt
assert ax.xaxis.isDefault_minfmt
assert ax.yaxis.isDefault_majfmt
assert ax.yaxis.isDefault_minfmt
ax.xaxis.set_major_formatter(_formfunc)
assert not ax.xaxis.isDefault_... | plots()
ax.plot(xdata, ydata1, color='blue', xunits="sec")
ax.plot(xdata, ydata2, color='green', xunits="hour")
ax.set_xlabel("x-label 005")
ax.autoscale_view()
def test_funcformatter_auto_formatter():
| 64 | 64 | 170 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_funcformatter_auto_formatter | test_funcformatter_auto_formatter | 212 | 235 | 212 | 212 | ffe0c62dfb410a90ed82045a75e6d5610fe01bdd | bigcode/the-stack | train |
7eb4a7761534d2b55d33d94c | train | function | def test_shared_scale():
fig, axs = plt.subplots(2, 2, sharex=True, sharey=True)
axs[0, 0].set_xscale("log")
axs[0, 0].set_yscale("log")
for ax in axs.flat:
assert ax.get_yscale() == 'log'
assert ax.get_xscale() == 'log'
axs[1, 1].set_xscale("linear")
axs[1, 1].set_... | def test_shared_scale():
| fig, axs = plt.subplots(2, 2, sharex=True, sharey=True)
axs[0, 0].set_xscale("log")
axs[0, 0].set_yscale("log")
for ax in axs.flat:
assert ax.get_yscale() == 'log'
assert ax.get_xscale() == 'log'
axs[1, 1].set_xscale("linear")
axs[1, 1].set_yscale("linear")
fo... | .arange(12).reshape((3, 4)), np.random.rand(3, 4, 3)]
)
def test_pcolorfast(xy, data, cls):
fig, ax = plt.subplots()
assert type(ax.pcolorfast(*xy, data)) == cls
def test_shared_scale():
| 64 | 64 | 144 | 5 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_shared_scale | test_shared_scale | 5,515 | 5,530 | 5,515 | 5,515 | f400fb1b2385052ddd41a3afc1dc4d792635f2c2 | bigcode/the-stack | train |
06d6ca120b1c5ba5efd9e7ea | train | function | @image_comparison(['rc_spines.png'], savefig_kwarg={'dpi': 40})
def test_rc_spines():
rc_dict = {
'axes.spines.left': False,
'axes.spines.right': False,
'axes.spines.top': False,
'axes.spines.bottom': False}
with matplotlib.rc_context(rc_dict):
plt.subplots() # c... | @image_comparison(['rc_spines.png'], savefig_kwarg={'dpi': 40})
def test_rc_spines():
| rc_dict = {
'axes.spines.left': False,
'axes.spines.right': False,
'axes.spines.top': False,
'axes.spines.bottom': False}
with matplotlib.rc_context(rc_dict):
plt.subplots() # create a figure and axes with the spine properties
| ()
assert after[0] == before[0] and after[1] > before[1]
assert ax.xaxis.offsetText.get_verticalalignment() == 'bottom'
@image_comparison(['rc_spines.png'], savefig_kwarg={'dpi': 40})
def test_rc_spines():
| 63 | 64 | 91 | 26 | 37 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_rc_spines | test_rc_spines | 5,394 | 5,402 | 5,394 | 5,395 | 380a63277271fd055434f5bf90be04e0114205f8 | bigcode/the-stack | train |
c7bf6019aaf8397b19c7534b | train | function | def _params(c=None, xsize=2, *, edgecolors=None, **kwargs):
return (c, edgecolors, kwargs if kwargs is not None else {}, xsize)
| def _params(c=None, xsize=2, *, edgecolors=None, **kwargs):
| return (c, edgecolors, kwargs if kwargs is not None else {}, xsize)
| ,
linewidths=[*range(1, 5), None])
assert_array_equal(pc.get_linewidths(),
[*range(1, 5), mpl.rcParams['lines.linewidth']])
def _params(c=None, xsize=2, *, edgecolors=None, **kwargs):
| 63 | 64 | 38 | 19 | 44 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | _params | _params | 2,384 | 2,385 | 2,384 | 2,384 | 7dceaeb1be149f7731162b35e14366a8f0eb6432 | bigcode/the-stack | train |
754afe59033504101d5bfe7f | train | function | def test_titlesetpos():
# Test that title stays put if we set it manually
fig, ax = plt.subplots()
fig.subplots_adjust(top=0.8)
ax2 = ax.twiny()
ax.set_xlabel('Xlabel')
ax2.set_xlabel('Xlabel2')
ax.set_title('Title')
pos = (0.5, 1.11)
ax.title.set_position(pos)
renderer... | def test_titlesetpos():
# Test that title stays put if we set it manually
| fig, ax = plt.subplots()
fig.subplots_adjust(top=0.8)
ax2 = ax.twiny()
ax.set_xlabel('Xlabel')
ax2.set_xlabel('Xlabel2')
ax.set_title('Title')
pos = (0.5, 1.11)
ax.title.set_position(pos)
renderer = fig.canvas.get_renderer()
ax._update_title_position(renderer)
asser... | _xlabel2 = xlabel2.get_window_extent(renderer).y1 # top of xlabel2
y_diff = bbox_y0_title - bbox_y1_xlabel2
assert np.isclose(y_diff, 3)
def test_titlesetpos():
# Test that title stays put if we set it manually
| 64 | 64 | 116 | 19 | 45 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_titlesetpos | test_titlesetpos | 6,016 | 6,028 | 6,016 | 6,017 | fb13072e81a2b743a33b6419575653777773388e | bigcode/the-stack | train |
603aacb90c8dca62f42ea96d | train | function | def test_hist_log_barstacked():
fig, axs = plt.subplots(2)
axs[0].hist([[0], [0, 1]], 2, histtype="barstacked")
axs[0].set_yscale("log")
axs[1].hist([0, 0, 1], 2, histtype="barstacked")
axs[1].set_yscale("log")
fig.canvas.draw()
assert axs[0].get_ylim() == axs[1].get_ylim()
| def test_hist_log_barstacked():
| fig, axs = plt.subplots(2)
axs[0].hist([[0], [0, 1]], 2, histtype="barstacked")
axs[0].set_yscale("log")
axs[1].hist([0, 0, 1], 2, histtype="barstacked")
axs[1].set_yscale("log")
fig.canvas.draw()
assert axs[0].get_ylim() == axs[1].get_ylim()
| type=histtype)
axs_test[1, i].set_yscale("log")
# Use hist(..., log=True).
for ax in axs_ref[:, i]:
ax.hist(1, 1, log=True, histtype=histtype)
def test_hist_log_barstacked():
| 64 | 64 | 114 | 8 | 56 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_log_barstacked | test_hist_log_barstacked | 1,760 | 1,767 | 1,760 | 1,760 | 7c69b27d31c2cae3d20561ba2b47de85a9852035 | bigcode/the-stack | train |
de40eba27bc1c261ea9ffa11 | train | function | def test_large_offset():
fig, ax = plt.subplots()
ax.plot((1 + np.array([0, 1.e-12])) * 1.e27)
fig.canvas.draw()
| def test_large_offset():
| fig, ax = plt.subplots()
ax.plot((1 + np.array([0, 1.e-12])) * 1.e27)
fig.canvas.draw()
| .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_large_offset():
| 64 | 64 | 41 | 5 | 59 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_large_offset | test_large_offset | 6,082 | 6,085 | 6,082 | 6,082 | 5a67dfb4a5025e4085a7124bf1aa327303f13a67 | bigcode/the-stack | train |
8a6e3b8e65d278d75fc6af0b | train | function | def test_title_xticks_top():
# Test that title moves if xticks on top of axes.
mpl.rcParams['axes.titley'] = None
fig, ax = 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():
# Test that title moves if xticks on top of axes.
| mpl.rcParams['axes.titley'] = None
fig, ax = plt.subplots()
ax.xaxis.set_ticks_position('top')
ax.set_title('xlabel top')
fig.canvas.draw()
assert ax.title.get_position()[1] > 1.04
| (0.5, 1.11)
ax.title.set_position(pos)
renderer = fig.canvas.get_renderer()
ax._update_title_position(renderer)
assert ax.title.get_position() == pos
def test_title_xticks_top():
# Test that title moves if xticks on top of axes.
| 64 | 64 | 79 | 21 | 42 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_title_xticks_top | test_title_xticks_top | 6,031 | 6,038 | 6,031 | 6,032 | 3a62934dab7288790af58b359bf4fd15d537cbcf | bigcode/the-stack | train |
79f48b309ed21d98d4d8e27f | train | function | @image_comparison(['bxp_customwidths.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customwidths():
_bxp_test_helper(bxp_kwargs=dict(widths=[0.10, 0.25, 0.65, 0.85]))
| @image_comparison(['bxp_customwidths.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customwidths():
| _bxp_test_helper(bxp_kwargs=dict(widths=[0.10, 0.25, 0.65, 0.85]))
| def test_bxp_scalarwidth():
_bxp_test_helper(bxp_kwargs=dict(widths=.25))
@image_comparison(['bxp_customwidths.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customwidths():
| 63 | 64 | 73 | 41 | 22 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_customwidths | test_bxp_customwidths | 2,803 | 2,808 | 2,803 | 2,807 | 21649348f3ea237230725a29153fd972ffd216f5 | bigcode/the-stack | train |
85eced940496c3fbe1e12453 | train | function | @image_comparison(['violinplot_vert_showall.png'])
def test_vert_violinplot_showall():
ax = plt.axes()
# First 9 digits of frac(sqrt(11))
np.random.seed(316624790)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=1, showextrema=1,
... | @image_comparison(['violinplot_vert_showall.png'])
def test_vert_violinplot_showall():
| ax = plt.axes()
# First 9 digits of frac(sqrt(11))
np.random.seed(316624790)
data = [np.random.normal(size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=1, showextrema=1,
showmedians=1,
quantiles=[[0.1, 0.9], [0.2, 0.8], [0.3, 0.7... | (size=100) for _ in range(4)]
ax.violinplot(data, positions=range(4), showmeans=0, showextrema=0,
showmedians=1)
@image_comparison(['violinplot_vert_showall.png'])
def test_vert_violinplot_showall():
| 64 | 64 | 143 | 22 | 42 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_vert_violinplot_showall | test_vert_violinplot_showall | 3,102 | 3,110 | 3,102 | 3,103 | fc09bfe4b4839235b36f9d015f8c04728e1bcdf5 | bigcode/the-stack | train |
857f3cfb6eeabbf99393afe2 | train | function | @image_comparison(['test_alpha'], remove_text=True)
def test_alpha():
np.random.seed(0)
data = np.random.random(50)
fig, ax = plt.subplots()
# alpha=.5 markers, solid line
ax.plot(data, '-D', color=[1, 0, 0], mfc=[1, 0, 0, .5],
markersize=20, lw=10)
# everything solid b... | @image_comparison(['test_alpha'], remove_text=True)
def test_alpha():
| np.random.seed(0)
data = np.random.random(50)
fig, ax = plt.subplots()
# alpha=.5 markers, solid line
ax.plot(data, '-D', color=[1, 0, 0], mfc=[1, 0, 0, .5],
markersize=20, lw=10)
# everything solid by kwarg
ax.plot(data + 2, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0, ... | , y = np.meshgrid(x, x)
xy = np.vstack((x.flatten(), y.flatten())).T
# perform inverse transform
ll = ax.transProjection.inverted().transform(xy)
# perform forward transform
xy2 = ax.transProjection.transform(ll)
# compare
np.testing.assert_array_almost_equal(xy, xy2, 3)
@image_... | 96 | 96 | 322 | 16 | 80 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_alpha | test_alpha | 3,957 | 3,984 | 3,957 | 3,958 | f22b5a6f7c8de64a7360bd7297ce156d32ce4b40 | bigcode/the-stack | train |
2230c6f6c7469d47f1e28366 | train | function | def test_hist_step_geometry():
bins = [0, 1, 2, 3]
data = [0, 0, 1, 1, 1, 2]
_, _, (polygon, ) = plt.hist(data,
bins=bins,
histtype='step')
xy = [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1], [3, 0]]
assert_array_equa... | def test_hist_step_geometry():
| bins = [0, 1, 2, 3]
data = [0, 0, 1, 1, 1, 2]
_, _, (polygon, ) = plt.hist(data,
bins=bins,
histtype='step')
xy = [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1], [3, 0]]
assert_array_equal(polygon.get_xy(), xy)
| , 1], [3, 1],
[3, 0], [2, 0], [2, 0], [1, 0], [1, 0], [0, 0]]
assert_array_equal(polygon.get_xy(), xy)
def test_hist_step_geometry():
| 64 | 64 | 127 | 6 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist_step_geometry | test_hist_step_geometry | 3,716 | 3,723 | 3,716 | 3,716 | 46d444fe3b6066c47960207e80faea06a0c3a336 | bigcode/the-stack | train |
e8f304aa3e0a527672996823 | train | function | def test_eventplot_legend():
plt.eventplot([1.0], label='Label')
plt.legend()
| def test_eventplot_legend():
| plt.eventplot([1.0], label='Label')
plt.legend()
| ):
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_eventplot_legend():
| 64 | 64 | 24 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_eventplot_legend | test_eventplot_legend | 6,187 | 6,189 | 6,187 | 6,187 | 0a282edb6b0bbc89caa2714b77b4ab3c44446181 | bigcode/the-stack | train |
ca64868adc724d8386cf7463 | train | function | @image_comparison(['rc_markerfill.png'])
def test_markers_fillstyle_rcparams():
fig, ax = plt.subplots()
x = np.arange(7)
for idx, (style, marker) in enumerate(
[('top', 's'), ('bottom', 'o'), ('none', '^')]):
matplotlib.rcParams['markers.fillstyle'] = style
ax.plot(x+idx,... | @image_comparison(['rc_markerfill.png'])
def test_markers_fillstyle_rcparams():
| fig, ax = plt.subplots()
x = np.arange(7)
for idx, (style, marker) in enumerate(
[('top', 's'), ('bottom', 'o'), ('none', '^')]):
matplotlib.rcParams['markers.fillstyle'] = style
ax.plot(x+idx, marker=marker)
| ax.plot((y % 2)*5 + np.arange(10)*10, np.ones(10)*10*y, linestyle='',
marker=marker, markersize=10+y/5, label=marker)
@image_comparison(['rc_markerfill.png'])
def test_markers_fillstyle_rcparams():
| 64 | 64 | 89 | 19 | 45 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_markers_fillstyle_rcparams | test_markers_fillstyle_rcparams | 4,143 | 4,150 | 4,143 | 4,144 | 9b9f4b59c207c1840b3df2328187a6e1e5e827ed | bigcode/the-stack | train |
85d6f7178a553d7998c54b55 | train | function | @image_comparison(['bxp_customwhisker.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customwhisker():
_bxp_test_helper(bxp_kwargs=dict(
whiskerprops=dict(linestyle='-', color='m', lw=3)))
| @image_comparison(['bxp_customwhisker.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customwhisker():
| _bxp_test_helper(bxp_kwargs=dict(
whiskerprops=dict(linestyle='-', color='m', lw=3)))
| =dict(
capprops=dict(linestyle='--', color='g', lw=3)))
@image_comparison(['bxp_customwhisker.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_customwhisker():
| 63 | 64 | 72 | 43 | 20 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_customwhisker | test_bxp_customwhisker | 2,732 | 2,738 | 2,732 | 2,736 | ca8dada331b5b73c6ac56fbf2e48ee0d07b68f5b | bigcode/the-stack | train |
b23b951c5e9941ec122c295d | train | function | @image_comparison(['rc_grid.png'], savefig_kwarg={'dpi': 40})
def test_rc_grid():
fig = plt.figure()
rc_dict0 = {
'axes.grid': True,
'axes.grid.axis': 'both'
}
rc_dict1 = {
'axes.grid': True,
'axes.grid.axis': 'x'
}
rc_dict2 = {
'axes.grid': Tr... | @image_comparison(['rc_grid.png'], savefig_kwarg={'dpi': 40})
def test_rc_grid():
| fig = plt.figure()
rc_dict0 = {
'axes.grid': True,
'axes.grid.axis': 'both'
}
rc_dict1 = {
'axes.grid': True,
'axes.grid.axis': 'x'
}
rc_dict2 = {
'axes.grid': True,
'axes.grid.axis': 'y'
}
dict_list = [rc_dict0, rc_dict1, rc_d... | axes.spines.top': False,
'axes.spines.bottom': False}
with matplotlib.rc_context(rc_dict):
plt.subplots() # create a figure and axes with the spine properties
@image_comparison(['rc_grid.png'], savefig_kwarg={'dpi': 40})
def test_rc_grid():
| 64 | 64 | 153 | 24 | 39 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_rc_grid | test_rc_grid | 5,405 | 5,424 | 5,405 | 5,406 | 160de1fd65254f8b64cfd78ea6602d3ff557f89c | bigcode/the-stack | train |
3b3321c8381f4c1acd322d12 | train | function | def test_set_position():
fig, ax = plt.subplots()
ax.set_aspect(3.)
ax.set_position([0.1, 0.1, 0.4, 0.4], which='both')
assert np.allclose(ax.get_position().width, 0.1)
ax.set_aspect(2.)
ax.set_position([0.1, 0.1, 0.4, 0.4], which='original')
assert np.allclose(ax.get_position().width... | def test_set_position():
| fig, ax = plt.subplots()
ax.set_aspect(3.)
ax.set_position([0.1, 0.1, 0.4, 0.4], which='both')
assert np.allclose(ax.get_position().width, 0.1)
ax.set_aspect(2.)
ax.set_position([0.1, 0.1, 0.4, 0.4], which='original')
assert np.allclose(ax.get_position().width, 0.15)
ax.set_aspect... | .xy2[0]) > 0
assert sign_y * (upper_left.xy2[1] - lower_left.xy2[1]) > 0
assert sign_y * (upper_right.xy2[1] - lower_right.xy2[1]) > 0
def test_set_position():
| 64 | 64 | 172 | 5 | 58 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_set_position | test_set_position | 6,372 | 6,382 | 6,372 | 6,372 | 0448dd2a76ee5c4899e65a024696ab701c98622a | bigcode/the-stack | train |
552cda952b1706237d6eb1d4 | train | function | def test_scatter_empty_data():
# making sure this does not raise an exception
plt.scatter([], [])
plt.scatter([], [], s=[], c=[])
| def test_scatter_empty_data():
# making sure this does not raise an exception
| plt.scatter([], [])
plt.scatter([], [], s=[], c=[])
| index=ids)
c = pd.Series([1, 1, 1, 1, 1, 0, 0, 0], index=ids)
plt.scatter(x, y, c)
def test_scatter_empty_data():
# making sure this does not raise an exception
| 64 | 64 | 34 | 18 | 46 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_scatter_empty_data | test_scatter_empty_data | 6,412 | 6,415 | 6,412 | 6,413 | 26b828fbca7a9e431284b7a46013632d185b666b | bigcode/the-stack | train |
bedfc04e85d3152d2b0de23a | train | function | @image_comparison(['markevery'], remove_text=True)
def test_markevery():
x = np.linspace(0, 10, 100)
y = np.sin(x) * np.sqrt(x/10 + 0.5)
# check marker only plot
fig, ax = plt.subplots()
ax.plot(x, y, 'o', label='default')
ax.plot(x, y, 'd', markevery=None, label='mark all')
ax.plo... | @image_comparison(['markevery'], remove_text=True)
def test_markevery():
| x = np.linspace(0, 10, 100)
y = np.sin(x) * np.sqrt(x/10 + 0.5)
# check marker only plot
fig, ax = plt.subplots()
ax.plot(x, y, 'o', label='default')
ax.plot(x, y, 'd', markevery=None, label='mark all')
ax.plot(x, y, 's', markevery=10, label='mark every 10')
ax.plot(x, y, '+', m... | .scatter([1, 2, 3], [4, 3, 2], marker=m)
ax.errorbar([1, 2, 3], [5, 4, 3], marker=m)
@image_comparison(['markevery'], remove_text=True)
def test_markevery():
| 64 | 64 | 152 | 17 | 47 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_markevery | test_markevery | 1,356 | 1,367 | 1,356 | 1,357 | bea5ff4de0224a294401940d1c7bbdc1815f8510 | bigcode/the-stack | train |
cf63fb8904cfdd9d733ed9cf | train | function | @image_comparison(['test_stairs_datetime.png'])
def test_stairs_datetime():
f, ax = plt.subplots(constrained_layout=True)
ax.stairs(np.arange(36),
np.arange(np.datetime64('2001-12-27'),
np.datetime64('2002-02-02')))
plt.xticks(rotation=30)
| @image_comparison(['test_stairs_datetime.png'])
def test_stairs_datetime():
| f, ax = plt.subplots(constrained_layout=True)
ax.stairs(np.arange(36),
np.arange(np.datetime64('2001-12-27'),
np.datetime64('2002-02-02')))
plt.xticks(rotation=30)
| ::-1]*2+11, x[:-1]+0.5, color='black', ls='--', lw=2,
baseline=12, hatch='//', label="H")
ax.legend(loc=0)
@image_comparison(['test_stairs_datetime.png'])
def test_stairs_datetime():
| 64 | 64 | 73 | 17 | 47 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stairs_datetime | test_stairs_datetime | 2,039 | 2,045 | 2,039 | 2,040 | 4d2b7a82353242664c19eaa1724ded340207367f | bigcode/the-stack | train |
6c3246d87fdc4cdd34c02acb | train | function | def test_hist2d_density():
x, y = np.random.random((2, 100))
ax = plt.figure().subplots()
for obj in [ax, plt]:
obj.hist2d(x, y, density=True)
| def test_hist2d_density():
| x, y = np.random.random((2, 100))
ax = plt.figure().subplots()
for obj in [ax, plt]:
obj.hist2d(x, y, density=True)
| posed before
# passing to pcolorfast
x = np.array([5]*100)
y = np.random.randn(100)-2
fig, ax = plt.subplots()
ax.hist2d(x, y, bins=10, rasterized=True)
def test_hist2d_density():
| 64 | 64 | 51 | 7 | 57 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist2d_density | test_hist2d_density | 2,118 | 2,122 | 2,118 | 2,118 | 58801b7dafd4ef47987d1c6d9fae8cd5fd6c23e1 | bigcode/the-stack | train |
ec5ca619da126f1c3c5b700b | train | function | @check_figures_equal(extensions=["png"])
def test_bar_decimal_center(fig_test, fig_ref):
ax = fig_test.subplots()
x0 = [1.5, 8.4, 5.3, 4.2]
y0 = [1.1, 2.2, 3.3, 4.4]
x = [Decimal(x) for x in x0]
y = [Decimal(y) for y in y0]
# Test image - vertical, align-center bar chart with Decimal() in... | @check_figures_equal(extensions=["png"])
def test_bar_decimal_center(fig_test, fig_ref):
| ax = fig_test.subplots()
x0 = [1.5, 8.4, 5.3, 4.2]
y0 = [1.1, 2.2, 3.3, 4.4]
x = [Decimal(x) for x in x0]
y = [Decimal(y) for y in y0]
# Test image - vertical, align-center bar chart with Decimal() input
ax.bar(x, y, align='center')
# Reference image
ax = fig_ref.subplots()
... | ax.bar([1, 2.5], [1, 2], width=[0.2, 0.5], tick_label=['a', 'b'],
align='center')
@check_figures_equal(extensions=["png"])
def test_bar_decimal_center(fig_test, fig_ref):
| 63 | 64 | 155 | 22 | 41 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bar_decimal_center | test_bar_decimal_center | 1,540 | 1,551 | 1,540 | 1,541 | f6013bf50fb30ac8382dc06f34e5b985f15539cf | bigcode/the-stack | train |
b731d01e383c56dc665fdc09 | train | function | def test_errorbar_colorcycle():
f, ax = plt.subplots()
x = np.arange(10)
y = 2*x
e1, _, _ = ax.errorbar(x, y, c=None)
e2, _, _ = ax.errorbar(x, 2*y, c=None)
ln1, = ax.plot(x, 4*y)
assert mcolors.to_rgba(e1.get_color()) == mcolors.to_rgba('C0')
assert mcolors.to_rgba(e2.get_... | def test_errorbar_colorcycle():
| f, ax = plt.subplots()
x = np.arange(10)
y = 2*x
e1, _, _ = ax.errorbar(x, y, c=None)
e2, _, _ = ax.errorbar(x, 2*y, c=None)
ln1, = ax.plot(x, 4*y)
assert mcolors.to_rgba(e1.get_color()) == mcolors.to_rgba('C0')
assert mcolors.to_rgba(e2.get_color()) == mcolors.to_rgba('C1')
... | fig.gca()
ax.errorbar("x", "y", xerr=0.2, yerr=0.4, data=data)
ax.set_title("Simplest errorbars, 0.2 in x, 0.4 in y")
def test_errorbar_colorcycle():
| 63 | 64 | 147 | 8 | 55 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_errorbar_colorcycle | test_errorbar_colorcycle | 3,356 | 3,368 | 3,356 | 3,357 | c61f8a90910f57b2c581ba1b354c0b361dd21609 | bigcode/the-stack | train |
6f079756a602e55e19056004 | train | function | @image_comparison(['hist2d_transpose'], remove_text=True, style='mpl20')
def test_hist2d_transpose():
# Remove this line when this test image is regenerated.
plt.rcParams['pcolormesh.snap'] = False
np.random.seed(0)
# make sure the output from np.histogram is transposed before
# passing to p... | @image_comparison(['hist2d_transpose'], remove_text=True, style='mpl20')
def test_hist2d_transpose():
# Remove this line when this test image is regenerated.
| plt.rcParams['pcolormesh.snap'] = False
np.random.seed(0)
# make sure the output from np.histogram is transposed before
# passing to pcolorfast
x = np.array([5]*100)
y = np.random.randn(100)-2
fig, ax = plt.subplots()
ax.hist2d(x, y, bins=10, rasterized=True)
| .subplots()
ax.hist2d("x", "y", bins=10, data=data, rasterized=True)
@image_comparison(['hist2d_transpose'], remove_text=True, style='mpl20')
def test_hist2d_transpose():
# Remove this line when this test image is regenerated.
| 64 | 64 | 130 | 40 | 24 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_hist2d_transpose | test_hist2d_transpose | 2,104 | 2,115 | 2,104 | 2,106 | 30c7bed194857caa4f714d16e567e1cd80cc9f29 | bigcode/the-stack | train |
647fe603be8c81b1628bbbdc | train | function | @image_comparison(['test_stairs_options.png'], remove_text=True)
def test_stairs_options():
x, y = np.array([1, 2, 3, 4, 5]), np.array([1, 2, 3, 4]).astype(float)
yn = y.copy()
yn[1] = np.nan
fig, ax = plt.subplots()
ax.stairs(y*3, x, color='green', fill=True, label="A")
ax.stairs(y, x*... | @image_comparison(['test_stairs_options.png'], remove_text=True)
def test_stairs_options():
| x, y = np.array([1, 2, 3, 4, 5]), np.array([1, 2, 3, 4]).astype(float)
yn = y.copy()
yn[1] = np.nan
fig, ax = plt.subplots()
ax.stairs(y*3, x, color='green', fill=True, label="A")
ax.stairs(y, x*3-3, color='red', fill=True,
orientation='horizontal', label="B")
ax.stair... | , 1, 2])
with pytest.raises(ValueError, match='Nan values in "edges"'):
h.set_data(edges=[1, np.nan, 2])
def test_stairs_invalid_update2():
h = plt.stairs([1, 2], [0, 1, 2])
with pytest.raises(ValueError, match='Size mismatch'):
h.set_data(edges=np.arange(5))
@image_comparison(['te... | 110 | 111 | 370 | 21 | 89 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_stairs_options | test_stairs_options | 2,015 | 2,036 | 2,015 | 2,016 | 74bc6cb0b6c39201f46984a05d537645a6c5070e | bigcode/the-stack | train |
a8521074d7ea61f3472cd07a | train | function | @image_comparison(['bxp_patchartist.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_patchartist():
_bxp_test_helper(bxp_kwargs=dict(patch_artist=True))
| @image_comparison(['bxp_patchartist.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_patchartist():
| _bxp_test_helper(bxp_kwargs=dict(patch_artist=True))
|
return stats
_bxp_test_helper(transform_stats=transform, bxp_kwargs=dict(vert=False))
@image_comparison(['bxp_patchartist.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_patchartist():
| 63 | 64 | 54 | 39 | 24 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_patchartist | test_bxp_patchartist | 2,667 | 2,672 | 2,667 | 2,671 | f050b8bda65e373df8c80ac1af24a135cf5c6f26 | bigcode/the-stack | train |
f9e00e050d19880b31774291 | train | function | @image_comparison(['bxp_scalarwidth.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_scalarwidth():
_bxp_test_helper(bxp_kwargs=dict(widths=.25))
| @image_comparison(['bxp_scalarwidth.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_scalarwidth():
| _bxp_test_helper(bxp_kwargs=dict(widths=.25))
| xp_showmeanasline():
_bxp_test_helper(bxp_kwargs=dict(showmeans=True, meanline=True))
@image_comparison(['bxp_scalarwidth.png'],
remove_text=True,
savefig_kwarg={'dpi': 40},
style='default')
def test_bxp_scalarwidth():
| 63 | 64 | 54 | 39 | 24 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_bxp_scalarwidth | test_bxp_scalarwidth | 2,795 | 2,800 | 2,795 | 2,799 | 1b8a3bfba9fb254e0c36dc3dc9ff33261a645838 | bigcode/the-stack | train |
528122bb477a8c0aa24d6563 | train | function | @check_figures_equal()
def test_label_loc_rc(fig_test, fig_ref):
with matplotlib.rc_context({"xaxis.labellocation": "right",
"yaxis.labellocation": "top"}):
ax = fig_test.subplots()
sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
ax.legend()
... | @check_figures_equal()
def test_label_loc_rc(fig_test, fig_ref):
| with matplotlib.rc_context({"xaxis.labellocation": "right",
"yaxis.labellocation": "top"}):
ax = fig_test.subplots()
sc = ax.scatter([1, 2], [1, 2], c=[1, 2], label='scatter')
ax.legend()
ax.set_ylabel('Y Label')
ax.set_xlabel('X Label')
... | left')
ax.set_xlabel('X Label', x=0, ha='left')
cbar = fig_ref.colorbar(sc, orientation='horizontal')
cbar.set_label("Z Label", x=0, ha='left')
@check_figures_equal()
def test_label_loc_rc(fig_test, fig_ref):
| 66 | 67 | 224 | 17 | 49 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_label_loc_rc | test_label_loc_rc | 86 | 104 | 86 | 87 | b220c28e9dd26cc28977703fdc250eb308c0cf55 | bigcode/the-stack | train |
eab663689eb5a4779b94d5d7 | train | function | @mpl.style.context('default')
def test_warn_ignored_scatter_kwargs():
with pytest.warns(UserWarning,
match=r"You passed a edgecolor/edgecolors"):
c = plt.scatter(
[0], [0], marker="+", s=500, facecolor="r", edgecolor="b"
)
| @mpl.style.context('default')
def test_warn_ignored_scatter_kwargs():
| with pytest.warns(UserWarning,
match=r"You passed a edgecolor/edgecolors"):
c = plt.scatter(
[0], [0], marker="+", s=500, facecolor="r", edgecolor="b"
)
| )**2
np.testing.assert_array_almost_equal_nulp(
np.array((-0.525, -(bot+0.05), 1.05, bot+0.1)), ax.dataLim.bounds, 16)
@mpl.style.context('default')
def test_warn_ignored_scatter_kwargs():
| 64 | 64 | 69 | 16 | 48 | arnoyu-hub/COMP0016miemie | venv/Lib/site-packages/matplotlib/tests/test_axes.py | Python | test_warn_ignored_scatter_kwargs | test_warn_ignored_scatter_kwargs | 7,154 | 7,161 | 7,154 | 7,155 | 2f3152e604ef665468bd97e2939a37654cc94fb8 | bigcode/the-stack | train |
fa72c0e90643c9ccdbc03ce9 | train | class | class SchemaNode:
"""
Represents a part of a JSON schema with additional metadata to help with documentation
"""
def __init__(
self,
depth: int,
file: str,
path_to_element: List[Union[str, int]],
html_id: str,
breadcrumb_name: str = "",
ref_path="... | class SchemaNode:
| """
Represents a part of a JSON schema with additional metadata to help with documentation
"""
def __init__(
self,
depth: int,
file: str,
path_to_element: List[Union[str, int]],
html_id: str,
breadcrumb_name: str = "",
ref_path="",
parent:... | import copy
from typing import Any, Dict, Iterable, Iterator, List, Optional, Set, Union, cast
import jinja2
from json_schema_for_humans import const
from json_schema_for_humans.templating_utils import get_type_name
from json_schema_for_humans.generation_configuration import GenerationConfiguration
circular_referenc... | 87 | 256 | 3,775 | 4 | 83 | clearbank/json-schema-for-humans | json_schema_for_humans/schema_node.py | Python | SchemaNode | SchemaNode | 13 | 508 | 13 | 13 | 97dd01021d6b443c7b6f554256288dc910de3432 | bigcode/the-stack | train |
a16648bf630a0b0cf702a55a | train | class | class Migration(migrations.Migration):
dependencies = [
('sites', '0003_set_site_domain_and_name'),
]
operations = [
migrations.AlterModelOptions(
name='site',
options={'ordering': ['domain'], 'verbose_name': 'site', 'verbose_name_plural': 'sites'},
),
]... | class Migration(migrations.Migration):
| dependencies = [
('sites', '0003_set_site_domain_and_name'),
]
operations = [
migrations.AlterModelOptions(
name='site',
options={'ordering': ['domain'], 'verbose_name': 'site', 'verbose_name_plural': 'sites'},
),
]
| # Generated by Django 3.1.1 on 2020-09-30 14:53
from django.db import migrations
class Migration(migrations.Migration):
| 36 | 64 | 68 | 7 | 28 | AngellusMortis/boundlexx | boundlexx/contrib/sites/migrations/0004_auto_20200930_1053.py | Python | Migration | Migration | 6 | 17 | 6 | 7 | f7bddaa33d24499a19378ca9419698f661f31230 | bigcode/the-stack | train |
5eb81c0001d1c4bbbfa3da45 | train | function | def AnovaRM_diff(csv_file, trls=None, sets=False):
"""
'csv_file' is either 'vel_diff' or 'time_diff'
'trls' is user-specified trials that will be used in the comparison,
leave as empty list if 'sets' is True
'sets' is an option to compare by sets (['ST1', 'UT1'] vs ['ST2', 'UT2'])
"""
... | def AnovaRM_diff(csv_file, trls=None, sets=False):
| """
'csv_file' is either 'vel_diff' or 'time_diff'
'trls' is user-specified trials that will be used in the comparison,
leave as empty list if 'sets' is True
'sets' is an option to compare by sets (['ST1', 'UT1'] vs ['ST2', 'UT2'])
"""
# 'voi' is the variable of interest: either 'vel_di... | """
Toxopy (https://github.com/bchaselab/Toxopy)
© M. Alyetama, University of Nebraska at Omaha
Licensed under the terms of the MIT license
"""
import pandas as pd
from pathlib import Path
from statsmodels.stats.anova import AnovaRM
def AnovaRM_diff(csv_file, trls=None, sets=False):
| 76 | 159 | 531 | 15 | 60 | bchaselab/Toxopy | toxopy/AnovaRM_diff.py | Python | AnovaRM_diff | AnovaRM_diff | 12 | 69 | 12 | 12 | 05092392e782cba0038fcc7f983bb4b82bf429ab | bigcode/the-stack | train |
a635b452fd9b349b898c9bcd | train | function | def on_assets(models: Models) -> None:
current_row = models.form.modelsList.currentRow()
current_notetype = models.mm.get(models.models[current_row].id)
exec_asset_manager_menu(models, current_notetype)
| def on_assets(models: Models) -> None:
| current_row = models.form.modelsList.currentRow()
current_notetype = models.mm.get(models.models[current_row].id)
exec_asset_manager_menu(models, current_notetype)
| :
dialog = asset_manager_menu(parent_window, note_type)
dialog.open()
def exec_asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> None:
dialog = asset_manager_menu(parent_window, note_type)
dialog.exec_()
def on_assets(models: Models) -> None:
| 64 | 64 | 47 | 10 | 54 | NSBum/anki_asset_manager | src/models.py | Python | on_assets | on_assets | 52 | 55 | 52 | 52 | d8810251da6f02963835ed800868faf8c258b568 | bigcode/the-stack | train |
897c7dd8da918977ddf6cd4e | train | function | def init_models_dialog():
models_did_init_buttons.append(init_asset_button)
| def init_models_dialog():
| models_did_init_buttons.append(init_asset_button)
| etype = models.mm.get(models.models[current_row].id)
exec_asset_manager_menu(models, current_notetype)
def init_asset_button(buttons, models: Models):
buttons.append(
(
"Assets...",
lambda: on_assets(models),
)
)
return buttons
def init_models_dialog():
| 64 | 64 | 16 | 5 | 58 | NSBum/anki_asset_manager | src/models.py | Python | init_models_dialog | init_models_dialog | 69 | 70 | 69 | 69 | 168e0a1d7f4fedc6b7b6c91503591cfbb6cd08a8 | bigcode/the-stack | train |
f13081ce6607ef807c162fc1 | train | function | def asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> QDialog:
dialog = ConfigDialog(parent_window, save, write_back)
dialog.setupUi(
note_type["id"],
note_type["name"],
get_html_setting_from_notetype(note_type),
get_setting_from_notetype(note_type),
)
r... | def asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> QDialog:
| dialog = ConfigDialog(parent_window, save, write_back)
dialog.setupUi(
note_type["id"],
note_type["name"],
get_html_setting_from_notetype(note_type),
get_setting_from_notetype(note_type),
)
return dialog
| _id, html_data, script_data)
write_media(model_id, script_data)
def save(model_id: int, html_data, script_data):
write_setting(html_data, script_data, model_id=model_id)
def asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> QDialog:
| 64 | 64 | 75 | 20 | 44 | NSBum/anki_asset_manager | src/models.py | Python | asset_manager_menu | asset_manager_menu | 30 | 39 | 30 | 30 | e0d99f0fe351626dbc95fa978b530dacc0a27db2 | bigcode/the-stack | train |
cb5d72a0287da1d16768c778 | train | function | def open_asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> None:
dialog = asset_manager_menu(parent_window, note_type)
dialog.open()
| def open_asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> None:
| dialog = asset_manager_menu(parent_window, note_type)
dialog.open()
| _back)
dialog.setupUi(
note_type["id"],
note_type["name"],
get_html_setting_from_notetype(note_type),
get_setting_from_notetype(note_type),
)
return dialog
def open_asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> None:
| 64 | 64 | 36 | 20 | 43 | NSBum/anki_asset_manager | src/models.py | Python | open_asset_manager_menu | open_asset_manager_menu | 42 | 44 | 42 | 42 | 5f019d35731f4d1c05ce4c9dee8da1de442cf391 | bigcode/the-stack | train |
fc62c5940e9feeb2dbcc643c | train | function | def save(model_id: int, html_data, script_data):
write_setting(html_data, script_data, model_id=model_id)
| def save(model_id: int, html_data, script_data):
| write_setting(html_data, script_data, model_id=model_id)
| write_back(model_id: int, html_data, script_data) -> None:
write_setting(html_data, script_data, model_id=model_id)
setup_model(model_id, html_data, script_data)
write_media(model_id, script_data)
def save(model_id: int, html_data, script_data):
| 64 | 64 | 27 | 13 | 51 | NSBum/anki_asset_manager | src/models.py | Python | save | save | 26 | 27 | 26 | 26 | 1e47e2b61fa902d8ca36d1e0e5e0cbed3faf1296 | bigcode/the-stack | train |
756765fd12803ac8b66e40ae | train | function | def exec_asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> None:
dialog = asset_manager_menu(parent_window, note_type)
dialog.exec_()
| def exec_asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> None:
| dialog = asset_manager_menu(parent_window, note_type)
dialog.exec_()
| _type),
)
return dialog
def open_asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> None:
dialog = asset_manager_menu(parent_window, note_type)
dialog.open()
def exec_asset_manager_menu(parent_window: QDialog, note_type: NoteType) -> None:
| 64 | 64 | 37 | 20 | 44 | NSBum/anki_asset_manager | src/models.py | Python | exec_asset_manager_menu | exec_asset_manager_menu | 47 | 49 | 47 | 47 | 296f6b95337bc7723c0ed927e970c55c7c58206b | bigcode/the-stack | train |
65f731c33f98604ecc1ad8a4 | train | function | def write_back(model_id: int, html_data, script_data) -> None:
write_setting(html_data, script_data, model_id=model_id)
setup_model(model_id, html_data, script_data)
write_media(model_id, script_data)
| def write_back(model_id: int, html_data, script_data) -> None:
| write_setting(html_data, script_data, model_id=model_id)
setup_model(model_id, html_data, script_data)
write_media(model_id, script_data)
| _config.config import ConfigDialog
from .config import (
write_setting,
get_setting_from_notetype,
get_html_setting_from_notetype,
)
from .model_editor import setup_model
from .media_writer import write_media
def write_back(model_id: int, html_data, script_data) -> None:
| 64 | 64 | 52 | 17 | 46 | NSBum/anki_asset_manager | src/models.py | Python | write_back | write_back | 19 | 23 | 19 | 19 | 6aa7c85ba35298ea4de02f88fc415f9ad8e71043 | bigcode/the-stack | train |
dbf050642d965bd7d917e39a | train | function | def init_asset_button(buttons, models: Models):
buttons.append(
(
"Assets...",
lambda: on_assets(models),
)
)
return buttons
| def init_asset_button(buttons, models: Models):
| buttons.append(
(
"Assets...",
lambda: on_assets(models),
)
)
return buttons
| )
dialog.exec_()
def on_assets(models: Models) -> None:
current_row = models.form.modelsList.currentRow()
current_notetype = models.mm.get(models.models[current_row].id)
exec_asset_manager_menu(models, current_notetype)
def init_asset_button(buttons, models: Models):
| 64 | 64 | 36 | 11 | 53 | NSBum/anki_asset_manager | src/models.py | Python | init_asset_button | init_asset_button | 58 | 66 | 58 | 58 | cb5b5d3398c66f67c96af2f83935496bc5d34d6a | bigcode/the-stack | train |
4443c6ef30b7b733e5e9a8e8 | train | function | def nuget_deps():
nuget_fetch(
name = "nuget",
packages = {
"CommandLineParser/2.8.0": ["net5.0"],
"FluentAssertions/6.2.0": ["net5.0"],
"Microsoft.Build.Utilities.Core/16.11.0": ["net5.0"],
"Microsoft.SqlServer.DacFx/150.5290.2-preview": ["net5.0"],
... | def nuget_deps():
| nuget_fetch(
name = "nuget",
packages = {
"CommandLineParser/2.8.0": ["net5.0"],
"FluentAssertions/6.2.0": ["net5.0"],
"Microsoft.Build.Utilities.Core/16.11.0": ["net5.0"],
"Microsoft.SqlServer.DacFx/150.5290.2-preview": ["net5.0"],
"Newton... | load("@rules_msbuild//deps:public_nuget.bzl", "FRAMEWORKS", "PACKAGES")
load("@rules_msbuild//dotnet:defs.bzl", "nuget_deps_helper", "nuget_fetch")
def nuget_deps():
| 55 | 64 | 189 | 6 | 49 | samhowes/rules_tsql | deps/nuget.bzl | Python | nuget_deps | nuget_deps | 4 | 19 | 4 | 4 | bab0b307611344fa1dfb647eebce3f33aae6a3d9 | bigcode/the-stack | train |
99648743eca0a0047cc2adb3 | train | class | class ToDoOversData(object):
"""Session data and application functions that don't fall in models or views.
This class will be stored in a cookie for a login session.
Attributes:
username (str): Username from Habitica.
hab_user_id (str): User ID from Habitica.
api_token (str): API t... | class ToDoOversData(object):
| """Session data and application functions that don't fall in models or views.
This class will be stored in a cookie for a login session.
Attributes:
username (str): Username from Habitica.
hab_user_id (str): User ID from Habitica.
api_token (str): API token from Habitica.
l... | """Application controller code - Habitica To Do Over tool
App controller functions for the Habitica To Do Over tool.
For functions that don't fit in the model or views.
"""
from __future__ import absolute_import
from builtins import str
from builtins import object
__author__ = "Katie Patterson kirska.com"
__license_... | 118 | 256 | 1,691 | 7 | 110 | iljamaurer/Habitica_ToDoOvers | to_do_overs/app_functions/to_do_overs_data.py | Python | ToDoOversData | ToDoOversData | 20 | 275 | 20 | 20 | 3b092f49eb13c56b08915db597febe198ba72db1 | bigcode/the-stack | train |
22cd9fdd64c26476a1dfe030 | train | function | def search_library():
'''
Loads the assimp library.
Throws exception AssimpError if no library_path is found
Returns: tuple, (load from filename function,
load from memory function,
export to filename function,
release function,
... | def search_library():
| '''
Loads the assimp library.
Throws exception AssimpError if no library_path is found
Returns: tuple, (load from filename function,
load from memory function,
export to filename function,
release function,
dll)
'''... | memory function,
export to filename function,
release function,
ctypes handle to assimp library)
'''
try:
load = dll.aiImportFile
release = dll.aiReleaseImport
load_mem = dll.aiImportFileFromMemory
... | 142 | 142 | 476 | 4 | 138 | IKholopov/TierGine | external/Assimp/port/PyAssimp/pyassimp/helper.py | Python | search_library | search_library | 201 | 260 | 201 | 201 | 8faef919c1211d7d45f744a356f19b827b6ca048 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.