@cleanup
def test_invisible_Line_rendering():
 N = (10 ** 7)
 x = np.linspace(0, 1, N)
 y = np.random.normal(size=N)
 fig = plt.figure()
 ax = plt.subplot(111)
 l = mlines.Line2D(x, y)
 l.set_visible(False)
 t_no_line = min(repeat(fig.canvas.draw, number=1, repeat=3))
 ax.add_line(l)
 t_unvisible_line = min(repeat(fig.canvas.draw, number=1, repeat=3))
 slowdown_factor = (t_unvisible_line / t_no_line)
 slowdown_threshold = 2
 assert (slowdown_factor < slowdown_threshold)

@ cleanup def test_invisible_Line_rendering ( ) : N = ( 10 ** 7 ) x = np . linspace ( 0 , 1 , N ) y = np . random . normal ( size = N ) fig = plt . figure ( ) ax = plt . subplot ( 111 ) l = mlines . Line2D ( x , y ) l . set_visible ( False ) t_no_line = min ( repeat ( fig . canvas . draw , number = 1 , repeat = 3 ) ) ax . add_line ( l ) t_unvisible_line = min ( repeat ( fig . canvas . draw , number = 1 , repeat = 3 ) ) slowdown_factor = ( t_unvisible_line / t_no_line ) slowdown_threshold = 2 assert ( slowdown_factor < slowdown_threshold )
github issue #1256 identified a bug in line .