コード例 #1
0
 def test_colorbar(self):
     arr = self.biarr
     for mode in ["density", "hist2d", "hexbin"]:
         with self.subTest(mode=mode):
             out = density(arr, mode=mode, colorbar=True)
             self.assertTrue(isinstance(out, matplotlib.axes.Axes))
         plt.close("all")
コード例 #2
0
 def test_multiple(self):
     """Test generation of plot with multiple records."""
     for arr in [self.biarr, self.triarr]:
         with self.subTest(arr=arr):
             out = density(arr, vmin=0)
             self.assertTrue(isinstance(out, matplotlib.axes.Axes))
             plt.close("all")
コード例 #3
0
 def test_none(self):
     """Test generation of plot with no data."""
     for arr in [np.empty(0)]:
         with self.subTest(arr=arr):
             out = density(arr)
             self.assertTrue(isinstance(out, matplotlib.axes.Axes))
             plt.close("all")
コード例 #4
0
 def test_colorbar(self):
     for arr in [self.biarr, self.triarr]:
         for mode in ["density", "hist2d"]:  # hexbin won't work for triarr
             with self.subTest(mode=mode):
                 out = density(arr, mode=mode, colorbar=True)
                 self.assertTrue(isinstance(out, matplotlib.axes.Axes))
             plt.close("all")
コード例 #5
0
 def test_cmap(self):
     arr = self.biarr
     cmap = "viridis"
     for mode in ["density", "hist2d", "hexbin"]:
         with self.subTest(mode=mode):
             out = density(arr, mode=mode, cmap=cmap)
             self.assertTrue(isinstance(out, matplotlib.axes.Axes))
         plt.close("all")
コード例 #6
0
 def test_contours(self):
     arr = self.biarr
     contours = [0.9, 0.5]
     for mode in ["density"]:
         with self.subTest(mode=mode):
             out = density(arr, mode=mode, contours=contours)
             self.assertTrue(isinstance(out, matplotlib.axes.Axes))
         plt.close("all")
コード例 #7
0
    def test_one(self):
        """Test generation of plot with one record."""

        for arr in [self.biarr[0, :], self.triarr[0, :]]:
            with self.subTest(arr=arr):
                out = density(arr)
                self.assertTrue(isinstance(out, matplotlib.axes.Axes))
                plt.close("all")
コード例 #8
0
 def test_contours_levels(self):
     arr = self.biarr
     mode = "density"
     for levels in [3, None]:
         with self.subTest(levels=levels):
             out = density(arr, mode=mode, contours=True, percentiles=False)
             self.assertTrue(isinstance(out, matplotlib.axes.Axes))
         plt.close("all")
コード例 #9
0
 def test_modes(self):  #
     """Tests different ploting modes."""
     for arr in [self.biarr, self.triarr]:
         with self.subTest(arr=arr):
             for mode in ["density", "hist2d", "hexbin"]:
                 with self.subTest(mode=mode):
                     try:
                         out = density(arr, mode=mode, vmin=0)
                         self.assertTrue(isinstance(out, matplotlib.axes.Axes))
                         plt.close("all")
                     except NotImplementedError:  # some are not implemented for 3D
                         pass
コード例 #10
0
 def test_bivariate_logscale(self):  #
     """Tests logscale for different ploting modes using bivariate data."""
     arr = self.biarr
     with np.errstate(invalid="ignore"):  # ignore for tests
         arr[arr < 0] = np.nan
     for logspacing in [(True, True), (False, False), (False, True), (True, False)]:
         lx, ly = logspacing
         with self.subTest(logx=lx, logy=ly):
             for mode in ["density", "hist2d", "hexbin"]:
                 with self.subTest(mode=mode):
                     out = density(arr, mode=mode, logx=lx, logy=ly)
                     self.assertTrue(isinstance(out, matplotlib.axes.Axes))
                 plt.close("all")