Skip to content

Text object priority does not work #431

@davis278

Description

@davis278

In the VCS Text Objects Jupyter notebook (https://cdat.llnl.gov/Jupyter-notebooks/vcs/VCS_Text_Objects/VCS_Text_Objects.html or https://github.com/CDAT/Jupyter-notebooks/tree/master/vcs/VCS_Text_Objects), in cell 22 I had to change the order of plotting to get the text for the names of the cities to plot on top of the map.

The original notebook (which I updated on 1/9/20) had the following code for cell 22, which is supposed to plot the text first, then plot the map below the text, but the text does not plot on top.(The text has a priority of 2 meaning it should be plotted on top of (or higher than) the map layer which has the default priority of 1.) For the new notebook, I changed the last four lines of the code listed below, so the map plots first, then the text is plotted so it shows up on top.

canvas.clear()

Continental U.S.A. region

lat1 = 15.
lat2 = 70.
lon1 = -140.
lon2 = -60.
proj = "lambert"

Read this subset of data in

clt = f("clt",time=slice(0,1),latitude=(lat1,lat2),longitude=(lon1,lon2),squeeze=1)

Use the Isofill method to plot the total cloudiness data

gm = vcs.createisofill()
gm.datawc_x1 = lon1
gm.datawc_x2 = lon2
gm.datawc_y1 = lat1
gm.datawc_y2 = lat2
gm.projection = proj

Use the default template, but don't modify it

templ = vcs.createtemplate()

Create and define the text object

txt = vcs.createtext()
txt.string = ["Washington D.C.", "New York", "Los Angeles"]
txt.halign = "center"
txt.valign = "half"
txt.color = "red"
txt.font = "Myfont"
txt.height = 15
txt.priority = 2
txt.angle = -5
txt.y = [38.9072, 40.7128, 34.0522]
txt.x = [-77.0369, -74.0060, -118.2437]
txt.worldcoordinate = [lon1, lon2, lat1, lat2]
txt.viewport = [templ.data.x1, templ.data.x2, templ.data.y1, templ.data.y2]
txt.projection = proj

Plot text first to show priority

canvas.plot(txt)

Now data plotted "bellow" text

canvas.plot(clt,gm)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions