Logo control on VCS canvas

You can trun on/off showing the default UV-CDAT logo, which is originally located at bottom right. You can add additional logo.

© The CDAT software was developed by LLNL. This tutorial was written by Charles Doutriaux and Jiwoo Lee (Sep 2017). This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344.

Download the Jupyter Notebook

Prepare a sample plot

Back to Top

Let's prepare a sample VCS plot to test logo control.

In [1]:
# Sample data
import requests
r = requests.get("https://cdat.llnl.gov/cdat/sample_data/clt.nc",stream=True)
with open("clt.nc","wb") as f:
    for chunk in r.iter_content(chunk_size=1024):
        if chunk:  # filter local_filename keep-alive new chunks
            f.write(chunk)
In [2]:
import cdms2, vcs
f = cdms2.open('clt.nc')
d = f('clt')
x = vcs.init()
x.plot(d)
Out[2]:

Trun OFF the default UV-CDAT logo

Back to Top

  • You can hide the default UV-CDAT logo, which is originally located at bottom right.
  • Use "drawlogooff"
In [3]:
x.drawlogooff()
x.clear()
x.plot(d)
Out[3]:

Turn ON the default UV-CDAT logo

Back to Top

  • You can bring back the default UV-CDAT logo, which is originally located at bottom right.
  • Use "drawlogoon"
In [4]:
x.drawlogoon()
x.clear()
x.plot(d)
Out[4]:

Insert additional logo<

Back to Top

  • Prepare image file of logo you want to add to your directory.
  • "vcs.utils.Logo" allows you to have additional logo.
  • Default location of new logo is top right.
In [5]:
x.clear()
logo2 = vcs.utils.Logo('./logo.png')
logo2.plot(x)
x.plot(d)
Out[5]:

Control logo location

Back to Top

  • You can adjust position of the logo by using ".x" and ".y"
  • Given number should be in range of 0 to 1. It is ratio, relative position on canvas.
In [6]:
x.clear()
logo2 = vcs.utils.Logo('./logo.png')
logo2.x = .05
logo2.y = .05
logo2.plot(x)
x.plot(d)
Out[6]:

Control logo size

Back to Top

  • You can adjust size of the logo by using ".source_width" and ".source_height"
  • Below example increases logo size by 3 times.
In [7]:
x.clear()
logo2 = vcs.utils.Logo('./logo.png')
logo2.x = .05
logo2.y = .05
logo2.width = logo2.source_width * 3
logo2.height = logo2.source_height * 3
logo2.plot(x)
x.plot(d)
Out[7]: