New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text disappear in png with bg=False #308

Open
doutriaux1 opened this Issue Feb 2, 2018 · 9 comments

Comments

Projects
None yet
5 participants
@doutriaux1
Member

doutriaux1 commented Feb 2, 2018

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")

@doutriaux1 doutriaux1 added the bug label Feb 2, 2018

@doutriaux1 doutriaux1 added this to the 3.0 milestone Feb 2, 2018

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Feb 2, 2018

might be related to #309

@scottwittenburg

This comment has been minimized.

Contributor

scottwittenburg commented Feb 2, 2018

Hi @charlesdoutriaux, I wonder if there's some difference between our environments? I'm running with the latest vcs master, and when I copy/pasted your script, it generated the attached image.

notext

Then I change to bg=False and get what appears to be an identical saved screenshot. Is there some text missing from that image? It does seem that the string "Mole fraction Trend (ppmb)" is not positioned where I would like to see it as someone looking at the chart. Maybe that is what you're referring to?

@sudipto00

This comment has been minimized.

sudipto00 commented Feb 2, 2018

Folks
I had reported this issue initially. Maybe this issue is related to the template chosen. I saw this issue with the template 'ASD' but it went away when I switched to 'default' template. I am not sure if its some sort of setting in the 'ASD' template that is causing these texts to not appear in PNG files.

@scottwittenburg

This comment has been minimized.

Contributor

scottwittenburg commented Feb 2, 2018

The reproduction script above uses the 'ASD' template you mentioned:

template = canvas.gettemplate('ASD')

When I ran that, it generated the image in the comment above, which does seem to have the texts in the png. I wonder if there is possibly something in your environment that is not in mine?

@sudipto00

This comment has been minimized.

sudipto00 commented Feb 2, 2018

I am not sure. All I can say is that I am running through conda stack, v 2.12 on Mac OS Sierra.
I have a feeling that there is something unstable about that issue. In another instance also I saw the same issue happen where I was using the template 'quick'. Even there with the same configuration the text was not appearing but then after trying repeatedly it suddenly started appearing.
This is strange but that is what I have seen. If you have the canvas open what I have seen is that, the image is drawn on the canvas the first time but then when "canvas.png" is called the canvas object is refreshed and that is when the text disappears and that is what shows up in the final png file.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Feb 21, 2018

@danlipsa any idea?

@aashish24

This comment has been minimized.

Contributor

aashish24 commented Feb 22, 2018

@danlipsa @scottwittenburg what you guys think. Could it be that text rendering is slow and it is a async issue? Although the write() should have forced GL to flush?

@scottwittenburg

This comment has been minimized.

Contributor

scottwittenburg commented Feb 22, 2018

I could investigate this issue if I could reproduce it. But I'm not sure what to do otherwise.

@danlipsa

This comment has been minimized.

Contributor

danlipsa commented Feb 22, 2018

@doutriaux1 @aashish24 This seems to be a template issue. According to the original reported the issue does not appear with the default template.

@doutriaux1 doutriaux1 modified the milestones: 3.0, Next Release Mar 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment