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: adddata createdisplay deletedata getdata setmaskl setmaskp setmaskt

Function: show
Description: show is used to put graphical objects (such as a datamatrix) into a display. Before you call show you have to create a display using the command createdisplay.


Link:
Usage: show(di, l_num, c_num, data1, data2, ...)
Input:
di Name of the display
l_num integer, the row of the display that contains the window in which you want to show the graphical object(s)
c_num integer, the column of the display that contains the window in which you want to show the graphical object(s)
data1 data matrix with at least 2 columns, or strings (strings must be put in quotation marks), or a combination of strigs and numbers (use the "string" function as in the final example below)

Example:



func("gennorm")				; load macro "gennorm"

sig=#(1,0.7)~#(0.7~1) 			; covariance matrix

z=gennorm(100,0|0,sig)		; create 100 observations of bivariate normal data

di1=createdisplay(1, 1) 		; creates a 1-window display 

show(di1,1,1,z)	        		; scatterplot of datamatrix z

Result:

shows the scatterplot of datamatrix z

Example:



func("gennorm")				; load macro "gennorm"

func("skerreg")				; load macro "skerreg"

sig=#(1,0.7)~#(0.7~1) 			; covariance matrix

z=gennorm(500,0|0,sig); create 100 observations of bivariate normal data

z=sort(z,1)				; sort data

{xs,mh}=skerreg(z[,1],z[,2],0.5) 	; kernel-smooth

di2=createdisplay(1,1)  		; create 1-window display 

show(di2, 1, 1, z, xs~mh) 		; datamatrix and smooth

Result:

shows the datamatrix and the smooth		

Example:



func("skerreg")				; load macro "skerreg"

func("gls")				; load macro "gls"

di3=createdisplay(2, 2) 		; create a 4-window display 

n=500					; sample size

x=1:n					; generate explanatory variable		

y=sin(x[,2]/100)+normal(500, 1)     	; generate dependent variable

b=gls(matrix(n)~x,y)			; OLS regression with intercept

yols=(matrix(n)~x)*b			; OLS  fit

{xs,mh}=skerreg(x,y,15)	; sorted explanatory variables (xs) and kernel fit (mh)

show(di3, 1, 1, x~y)			;scatterplot

show(di3, 1, 2, x~y,xs~mh)		; scatterplot and kernel smooth

; to display strings, put them in quotation marks

; to create a new line use stacking up operator "|"

; to combine strings with numerical elements use "string" function

show(di3, 2, 1, "OLS estimates"|string("intercept= %f", b[1,])|string("slope= %f", b[2,]))

show(di3, 2, 2, x~y, x~yols)		; scatterplot and OLS fit

Result:

you see it yourself.


Group: Plot Manipulation
See also: adddata createdisplay deletedata getdata setmaskl setmaskp setmaskt

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, 21.9.2000