示例#1
0
 def testLibs(self):
     p = pygg.ggplot('diamonds', pygg.aes(x='carat', y='price'))
     p += pygg.geom_point()
     tmpfile = tempfile.NamedTemporaryFile(suffix='.pdf').name
     pygg.ggsave(tmpfile, p, data=None, libs=['grid'], quiet=True)
     self.assertTrue(os.path.exists(tmpfile))
     self.assertTrue(os.path.getsize(tmpfile) > 0)
示例#2
0
 def testLibs(self):
     p = pygg.ggplot('diamonds', pygg.aes(x='carat', y='price'))
     p += pygg.geom_point()
     tmpfile = tempfile.NamedTemporaryFile(suffix='.pdf').name
     pygg.ggsave(tmpfile, p, data=None, libs=['grid'], quiet=True)
     self.assertTrue(os.path.exists(tmpfile))
     self.assertTrue(os.path.getsize(tmpfile) > 0)
示例#3
0
 def testBadGGPlotFails(self):
     p = pygg.ggplot('diamonds', pygg.aes(x='MISSING')) + pygg.geom_point()
     with self.assertRaises(ValueError):
         tmpfile = tempfile.NamedTemporaryFile(suffix=".png").name
         pygg.ggsave(tmpfile, p, data=None, quiet=True)
示例#4
0
 def check_ggsave(self, plotobj, data, ext='.pdf'):
     tmpfile = tempfile.NamedTemporaryFile(suffix=ext).name
     pygg.ggsave(tmpfile, plotobj, data=data, quiet=True)
     self.assertTrue(os.path.exists(tmpfile))
     self.assertTrue(os.path.getsize(tmpfile) > 0)
示例#5
0
 def testBadGGPlotFails(self):
     p = pygg.ggplot('diamonds', pygg.aes(x='MISSING')) + pygg.geom_point()
     with self.assertRaises(ValueError):
         tmpfile = tempfile.NamedTemporaryFile(suffix=".png").name
         pygg.ggsave(tmpfile, p, data=None, quiet=True)
示例#6
0
 def check_ggsave(self, plotobj, data=None, ext='.pdf'):
     tmpfile = tempfile.NamedTemporaryFile(suffix=ext).name
     pygg.ggsave(tmpfile, plotobj, data=data, quiet=True)
     self.assertTrue(os.path.exists(tmpfile))
     self.assertTrue(os.path.getsize(tmpfile) > 0)