Group: | Plot Manipulation |
See also: | show getgopt |
Function: | setgopt | |
Description: | Controls the layout of a display. First, the display should be created and shown. Then call setgopt to change its headline, the labels of its axes, limits, etc. |
Usage: | setgopt(di, l_num, c_num, gropt) or setgopt(di, l_num, c_num, optionname, optionvalue {, optionname1, optionvalue1} {, optionname2, optionvalue2} {...}) | |
Input: | ||
di | string, name of a display | |
l_num | integer, represents the number of a row of the display di | |
c_num | integer, represents the number of a column of the display di | |
gropt | special object that is obtained by the command gropt = getgopt(...) and which includes all graphic options from another display. | |
optionname | string, specifies the option to be changed. Allowed are:
| |
optionvalue | string, representing the new value for this option:
|
1) the desired display options are specified explicitly or
2) the display options are taken from another display via getgopt.
di=createdisplay(1, 1) x=1:100 y=sin(x/20)+uniform(100, 1)/10 show(di, 1, 1, x~y, x~knn(y, 10)) setgopt(di, 1,1, "border", 0) ; disable borders print(di, "TEST.ps") ; write PS file without border setgopt(di, 1,1, "border", 1) ; enable border(default) print(di, "TEST2.ps") ; PS file with border
Two Postscript-files, one with border and one without
; title and axes labels dis=createdisplay(1, 1) x=1:100 y=sqrt(x) data=x~y show(dis, 1, 1, data) setgopt(dis,1,1,"title","Plot of Sqrt(x)","xlabel","x","ylabel","y=sqrt(x)","dispsize",450|400,"disppos",20|20) ; 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,"dispsize",450|400,"disppos",400|400) 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) ;limits, 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,"dispsize",500|500,"disppos",600|25) 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)
Three different displays are shown that demonstrate some of the possibilities of setgopt.