Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Plot Manipulation
See also: show getgopt

Function: setgopt
Description: setgopt controls the layout of a display. First create and show the display. Then call setgopt to change its headline, axes labels and limits, etc.. There are two versions of setgopt: one, where you explicitly specify the desired display options and one, where you get the display options from another display via getgopt.


Usage: setgopt(di, l_num, c_num, gropt) or setgopt(di, l_num, c_num, optionname, optionvalue {, optionname1, optionvalue1} {, optionname2, optionvalue2} {...})
Input:
di Display
l_num integer, 1 ... count of lines of di
c_num integer, 1 ... count of columns of di
gropt a special object, that is obtained by the command gropt=getgopt(...) and includes all graphic options from another display.
optionname the option, to be changed. Allowed are:
"title"
to change headline,
"xlim"
to change limits for x-axis,
"ylim"
to change limits for y-axis,
"xoffset"
to change the width of axis border
"yoffset"
to change the height of axis border
"xvalue"
to change the values m and k of the transformation m+k*x (x-axis),
"yvalue"
to change the values m and k by m+k*y (y-axis),
"xorigin"
to change origin for tickmarks of x-axis,
"yorigin"
to change origin for tickmarks of y-axis,
"xmajor"
to change major for tickmark of x-axis,
"ymajor"
to change major for tickmark y-axis,
"xlabel"
to change label of x-axis,
"ylabel"
to change label of y-axis,
"rotpoint"
to change rotation point ,
"rotcos"
to change rotation cosinus matrix,
"scal"
to change scale matrix,
"transl"
to change translation vector he layeri
optionvalue the new value for this option
"title"
a string
"xlim"
a vector that contains two values, e. g. 0 | 10
"ylim"
a vector that contains two values, e. g. 0 | 10
"xoffset"
a vector that contains two values to change the right and left widths of axis border (in percent)
"yoffset"
a vector that contains two values to change the upper an d lower heights of axis border (in percent)
"xvalue"
a vector that contains two values to change m and k in m+k*x, e. g. 0 | 1 for 0+1*x
"yvalue"
a vector that containss two values to change m and k in m+k*y, e. g. 0 | 1 for 0+1*y
"xorigin"
a value ( usually 0.0)
"yorigin"
a value ( usually 0.0)
"xmajor"
a value for major of tickmarks of x-axis
"ymajor"
a value for major of tickmarks of y-axis
"xlabel"
a string to label x-axis
"ylabel"
a string to label y-axis
"rotpoint"
a rotation point vector
"rotcos"
a rotation cosinus matrix
"scal"
a diagonal scale matrix
"transl"
a translation vector D>
"ou

Example:

;title and axes labels
di=createdisplay(1, 1) 
x=1:100 
y=sqrt(x)
data=x~y 
show(di, 1, 1, data) 
setgopt(di,1,1,"title","Plot of Sqrt(x)","xlabel","x","ylabel","y=sqrt(x)")
; varying xoffset and yoffset
library("xplore")
n       =       100
s1      =       1
s2      =       1
rho    =       0.3
ss     =       #(s1,rho)~#(rho,s2)
u       =       gennorm(n, #(0,0), ss)        ; gen 2 dim normal data
d=createdisplay (2,2)
show (d,1,1,u)
setgopt (d,1,1,"title","very small offset","xlim",-4|4,"ylim",-4|4,"yoffset", 5|5, "xoffset", 5|5)
show (d,1,2,u)
setgopt (d,1,2,"title","small  offset","xlim",-4|4,"ylim",-4|4,"yoffset", 10|10, "xoffset", 10|10)
show(d,2,1,u)
setgopt (d,2,1,"title","large offset ","xlim",-4|4,"ylim",-4|4,"yoffset", 15|15, "xoffset", 15|15)
show(d,2,2,u)
setgopt(d,2,2,"title","very large offset","xlim",-4|4,"ylim",-4|4,"yoffset", 20|20, "xoffset", 20|20)
;lmits, majors and offsets
di=createdisplay(2, 2)
y=sin(x/20)+uniform(100, 1)/10 
show(di, 1, 1, x~y) 
show(di, 1, 2, x~y) 
show(di, 2, 1, x~y) 
show(di, 2, 2, x~y) 
setgopt(di, 1, 1,"title","default") 
setgopt(di, 1, 2,"title","ylim = (-4) | 4, xlim = 0 | 50", "ylim", (-4)|4,"xlim", 0|50) 
setgopt(di, 2, 1,"title","ymajor = 0.3, xmajor = 15","ymajor", 0.3,"xmajor", 15) 
setgopt(di, 2, 2,"title","yoffset = 13 | 13, xoffset = 20 | 20", "yoffset", 13|13,"xoffset", 20|20) 
Result:
displays that demonstrate some of the capabilities of setgopt.

Group: Plot Manipulation
See also: show getgopt

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

(C) MD*TECH Method and Data Technologies, 17.8.2000