8000 Added unit tests for bug fix for matplotlib#16552 · CSCD01/matplotlib-team28@f58bdfd · GitHub
[go: up one dir, main page]

Skip to content

Commit f58bdfd

Browse files
committed
Added unit tests for bug fix for matplotlib#16552
1 parent 8a2e041 commit f58bdfd

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6343,3 +6343,61 @@ def test_invisible_axes():
63436343
assert fig.canvas.inaxes((200, 200)) is not None
63446344
ax.set_visible(False)
63456345
assert fig.canvas.inaxes((200, 200)) is None
6346+
6347+
@check_figures_equal()
6348+
def test_scatter_autoscaling_w_zero_xy(fig_test, fig_ref):
6349+
x_vals = [0, 4.38462e-06, 5.54929e-06, 7.02332e-06, 8.88889e-06]
6350+
y_vals = [0, 0.10000000000000002, 0.182, 0.332, 0.604]
6351+
6352+
pts = np.array(list(itertools.product(x_vals, y_vals))) # This converts the values to a numpy array
6353+
6354+
ax_test = fig_test.gca()
6355+
ax_test.set_yscale('log')
6356+
ax_test.plot(pts[:,0], pts[:,1], marker="o", ls="")
6357+
6358+
ax_ref = fig_ref.gca()
6359+
ax_ref.set_yscale('log')
6360+
ax_ref.plot(pts[:,0], pts[:,1], marker="o", ls="")
6361+
6362+
def test_scatter_autoscaling_w_zero_x(fig_test, fig_ref):
6363+
x_vals = [0, 4.38462e-06, 5.54929e-06, 7.02332e-06, 8.88889e-06]
6364+
y_vals = [0.10000000000000002, 0.182, 0.332, 0.604]
6365+
6366+
pts = np.array(list(itertools.product(x_vals, y_vals))) # This converts the values to a numpy array
6367+
6368+
ax_test = fig_test.gca()
6369+
ax_test.set_yscale('log')
6370+
ax_test.plot(pts[:,0], pts[:,1], marker="o", ls="")
6371+
6372+
ax_ref = fig_ref.gca()
6373+
ax_ref.set_yscale('log')
6374+
ax_ref.plot(pts[:,0], pts[:,1], marker="o", ls="")
6375+
6376+
def test_scatter_autoscaling_w_zero_y(fig_test, fig_ref):
6377+
x_vals = [4.38462e-06, 5.54929e-06, 7.02332e-06, 8.88889e-06]
6378+
y_vals = [0, 0.10000000000000002, 0.182, 0.332, 0.604]
6379+
6380+
pts = np.array(list(itertools.product(x_vals, y_vals))) # This converts the values to a numpy array
6381+
6382+
ax_test = fig_test.gca()
6383+
ax_test.set_yscale('log')
6384+
ax_test.plot(pts[:,0], pts[:,1], marker="o", ls="")
6385+
6386+
ax_ref = fig_ref.gca()
6387+
ax_ref.set_yscale('log')
6388+
ax_ref.plot(pts[:,0], pts[:,1], marker="o", ls="")
6389+
6390+
def test_scatter_autoscaling_wo_zero(fig_test, fig_ref):
6391+
x_vals = [4.38462e-06, 5.54929e-06, 7.02332e-06, 8.88889e-06]
6392+
y_vals = [0.10000000000000002, 0.182, 0.332, 0.604]
6393+
6394+
pts = np.array(list(itertools.product(x_vals, y_vals))) # This converts the values to a numpy array
6395+
6396+
ax_test = fig_test.gca()
6397+
ax_test.set_yscale('log')
6398+
ax_test.plot(pts[:,0], pts[:,1], marker="o", ls="")
6399+
6400+
ax_ref = fig_ref.gca()
6401+
ax_ref.set_yscale('log')
6402+
ax_ref.plot(pts[:,0], pts[:,1], marker="o", ls="")
6403+

0 commit comments

Comments
 (0)
0