Logo control on VCS canvas

  • Download Jupyter Notebook ipynb

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

  • You can add additional logo.

Tutorial written by Jiwoo Lee (Sep. 2017)

Used env: vcs-2.12, uvcdat-2.12

Prepare a sample plot

(top)

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

[1]:
import cdms2, vcs
f = cdms2.open('clt.nc')
d = f('clt')
x = vcs.init()
x.plot(d)
[1]:
../_images/Jupyter_Logo_Control_3_0.png

Control logo location

(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.

[5]:
x.clear()
logo2 = vcs.utils.Logo('./logo.png')
logo2.x = .05
logo2.y = .05
logo2.plot(x)
x.plot(d)
[5]:
../_images/Jupyter_Logo_Control_11_0.png

Control logo size

(top) - You can adjust size of the logo by using “.source_width” and “.source_height” - Below example increases logo size by 3 times.

[6]:
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)
[6]:
../_images/Jupyter_Logo_Control_13_0.png
  • Below example reduces logo size to half.

[7]:
x.clear()
logo2 = vcs.utils.Logo('./logo.png')
logo2.x = .05
logo2.y = .05
logo2.width = logo2.source_width * .5
logo2.height = logo2.source_height * .5
logo2.plot(x)
x.plot(d)
[7]:
../_images/Jupyter_Logo_Control_15_0.png

Hide unwanted information above the plot

(top) - If your new logo is conflict with text information above the plot, you can hide unwanted items. - Below, some of text are overlapped with the new logo.

[8]:
x.clear()
logo2 = vcs.utils.Logo('./logo.png')
logo2.x = .1
logo2.y = .9
logo2.plot(x)
x.plot(d)
[8]:
../_images/Jupyter_Logo_Control_17_0.png
  • Let’s hide those text above the plot.

[9]:
my_template = vcs.createtemplate()
# Turn off no-needed information -- prevent overlap
my_template.blank(['title','dataname','crdate','crtime','mean','min','max',
           'units','zvalue','tvalue','xunits','yunits','xname','yname'])
x.clear()
logo2.plot(x)
x.plot(d,my_template)
[9]:
../_images/Jupyter_Logo_Control_19_0.png
  • To identify text you want to hide, please see below.

controllable_parameters