Skip to content

text disappear in png with bg=False #308

@doutriaux1

Description

@doutriaux1
import vcs, EzTemplate, cdms2

canvas = vcs.init(geometry={"width":1200, "height":800}, bg=True)
canvas.open()
canvas.enableLogo = False  # Remove the UVCDAT logo
iso = canvas.createisofill()

template = canvas.gettemplate('ASD')
template.blank(["title","mean","min","max","dataname","crdate","crtime","units"])
# Now fore indvidual element to appear as needed.
template.data.priority = 1
template.box1.priority = 1
template.xtic1.priority = 1
template.xlabel1.priority = 1
template.xlabel1.y = .22 # xlabels vertical offset
template.xname.priority = 1
template.yname.priority = 1
template.ylabel1.priority = 1
# Dont want xtop and yright axis
template.xtic2.priority = 0
template.ytic2.priority = 0

# Multiple plots
M = EzTemplate.Multi(rows=2,columns=2,template=template)
M.template = template.name
M.legend.direction = 'horizontal'
M.margins.left = .07
M.margins.right = .02
M.margins.bottom = .25
M.margins.top = .10
M.legend.thickness = .1
M.legend.stretch = 0.5
M.spacing.vertical = .05
M.spacing.horizontal = .05
canvas.setcolormap("bl_to_darkred")
iso.ext_1 = True
iso.ext_2 = True

ssig = cdms2.open(vcs.sample_data+"/clt.nc")("clt")

# The actual plotting portion
for i in range(4):
    tm = ssig[i]
    tm = tm*1e9
    t = M.get(legend='none')
    t.xtic2.priority = 0
    t.ytic2.priority = 0
    t.xlabel2.priority = 0
    t.ylabel2.priority = 0
    t.xlabel1.y = .23 # xlabels vertical offset
    t.xname.y = 0.19
    t.yname.x = 0.03
    canvas.plot(tm, iso,t, yrev=True, continents=4, bg=True)
    if (i == 3):
        # Add legend label
        title = canvas.createtext()
        title.To.height = 12
        title.To.halign = "center"
        title.To.valign = "top"
        title.x = .5
        title.y = .9
        title.string = ['Mole fraction Trend (ppmb)']
        canvas.plot(title)
canvas.png("notext")

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions