Esempio n. 1
0
    def test11(self):
        bg = True
        n = 4

        self.M = EzTemplate.Multi(
            rows=1,
            columns=1,
            legend_direction='vertical',
            right_margin=.2,
            left_margin=.15,
            top_margin=.15,
            bottom_margin=.15)
        t = self.M.get()
        leg = t.legend
        tt = self.x.gettexttable(leg.texttable)
        to = self.x.gettextorientation(leg.textorientation)

        OD = EzTemplate.oneD(n=n, template=t)

        x = MV2.arange(0, 360)
        x = x / 180. * MV2.pi
        ax = cdms2.createAxis(x)
        self.x.portrait()

        for i in range(n):
            y = MV2.sin((i + 1) * x)
            y.setAxis(0, ax)
            yx = self.x.createyxvsx()
            yx.linecolor = 241 + i
            yx.datawc_y1 = -1.
            yx.datawc_y2 = 1.
            y.id = str(i)
            t = OD.get()
            self.x.plot(y, t, yx, bg=bg)
        self.checkImage('test_EzTemplate_11.png')
    def testMultiple(self):
        f = cdms2.open(os.path.join(cdat_info.get_sampledata_path(), 'clt.nc'))
        s = f('clt', slice(0, 1))
        f.close()

        M = EzTemplate.Multi(rows=2, columns=2)
        for i in range(4):
            self.x.plot(s, M.get())
        self.checkImage("test_vcsaddons_multiple_x.png")

        y = vcs.init(bg=True, geometry={"width": 1200, "height": 1090})
        M2 = EzTemplate.Multi(rows=1, columns=2)
        for i in range(2):
            y.plot(s, M2.get())
        y.png("tests_png/test_vcsaddons_multiple_y.png")
        self.checkImage("test_vcsaddons_multiple_y.png", pngReady=True)
Esempio n. 3
0
 def setUp(self):
     # This is for circleci that crashes for any mac bg=True
     self.x = vcs.init(geometry=self.geometry, bg=self.bg)
     self.x.setantialiasing(0)
     self.x.drawlogooff()
     if self.geometry is not None:
         self.x.setbgoutputdimensions(self.geometry['width'],
                                      self.geometry['height'],
                                      units="pixels")
     # if not self.bg:
     #    self.x.open()
     self.orig_cwd = os.getcwd()
     self.pngsdir = "tests_png"
     if not os.path.exists(self.pngsdir):
         os.makedirs(self.pngsdir)
     self.basedir = os.path.join("tests", "baselines")
     self.basedatadir = os.path.join("tests", "data")
     self.M = EzTemplate.Multi(rows=4, columns=3, x=self.x)
Esempio n. 4
0
import os, sys, vcs.testing.regression as regression

import vcs
from vcsaddons import EzTemplate
import cdms2, vcs, sys
## 12 plots 1 legend per row on the right
## Initialize VCS
x = vcs.init()
x.drawlogooff()
bg = True
M = EzTemplate.Multi(rows=4, columns=3)
M.legend.direction = 'vertical'
for i in range(12):
    t = M.get(legend='local')
    if i % 3 != 2:
        t.legend.priority = 0  # Turn off legend
fnm = "test_12_plot_one_leg_per_row_right.png"
M.preview(fnm, bg=bg)
ret = regression.check_result_image(fnm, sys.argv[1])
if not bg:
    raw_input("Press Enter")
sys.exit(ret)