Personal tools
You are here: Home CDAT Tutorials Adding your own menus and function into VCDAT Defining your own plotting function and putting them into VCDAT
Document Actions

Defining your own plotting function and putting them into VCDAT

by Charles Doutriaux last modified 2008-01-09 14:36

Explains how to create a plotting tools you can plug into VCDAT

This tutorial will indicate the basics on creating a plotting tools that can later be added into VCDAT (via user menu) and take advantage of the tempalte, and defined variables panel.



The function declaration

The function you will link to VCDAT must take the following arguments as input:

def myfunc(parent,x,template,*vars):

  print 'ok code here'

  return displays


where:

parent is the actual VCDAT object, which you can actually use to control any aspect of VCDAt

x is the vcs canvas on which you should draw

template is the template the user would like to draw

vars: the variable(s) the user wishes to send to your plotting tool

RETURN displays. In order for the function to work correctly make sure to keep a list of all the displays your generated using vcs
example:
d = x.plot(data)
keep "d" put it into a list and keep appending
At the end of your plotting function, make ure to return the list of all the displays generated.




When adding such a function to your vcdat menus make sure to check the box "This function plots onto the VCS canvas"




Powered by Plone