<s> from __future__ import division , print_function , absolute_import <EOL> from numpy . testing import dec , assert_ , assert_array_equal <EOL> try : <EOL> import matplotlib <EOL> matplotlib . rcParams [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> import matplotlib . pyplot as plt <EOL> from matplotlib . collections import LineCollection <EOL> has_matplotlib = True <EOL> except : <EOL> has_matplotlib = False <EOL> from scipy . spatial import delaunay_plot_2d , voronoi_plot_2d , convex_hull_plot_2d , Delaunay , Voronoi , ConvexHull <EOL> class TestPlotting : <EOL> points = [ ( <NUM_LIT:0> , <NUM_LIT:0> ) , ( <NUM_LIT:0> , <NUM_LIT:1> ) , ( <NUM_LIT:1> , <NUM_LIT:0> ) , ( <NUM_LIT:1> , <NUM_LIT:1> ) ] <EOL> @ dec . skipif ( not has_matplotlib , "<STR_LIT>" ) <EOL> def test_delaunay ( self ) : <EOL> fig = plt . figure ( ) <EOL> obj = Delaunay ( self . points ) <EOL> s_before = obj . simplices . copy ( ) <EOL> r = delaunay_plot_2d ( obj , ax = fig . gca ( ) ) <EOL> assert_array_equal ( obj . simplices , s_before ) <EOL> assert_ ( r is fig ) <EOL> delaunay_plot_2d ( obj , ax = fig . gca ( ) ) <EOL> @ dec . skipif ( not has_matplotlib , "<STR_LIT>" ) <EOL> def test_voronoi ( self ) : <EOL> fig = plt . figure ( ) <EOL> obj = Voronoi ( self . points ) <EOL> r = voronoi_plot_2d ( obj , ax = fig . gca ( ) ) <EOL> assert_ ( r is fig ) <EOL> voronoi_plot_2d ( obj ) <EOL> voronoi_plot_2d ( obj , show_vertices = False ) <EOL> @ dec . skipif ( not has_matplotlib , "<STR_LIT>" ) <EOL> def test_convex_hull ( self ) : <EOL> fig = plt . figure ( ) <EOL> tri = ConvexHull ( self . points ) <EOL> r = convex_hull_plot_2d ( tri , ax = fig . gca ( ) ) <EOL> assert_ ( r is fig ) <EOL> convex_hull_plot_2d ( tri ) </s>
