| Group: | Plot Manipulation |
| See also: | createdisplay show |
| Function: | addbutton | |
| Description: |
Adds a button with some functionality to the plot menu.
|
| Usage: | addbutton(di, l_num, c_num, name, function) | |
| Input: | ||
| di | Display | |
| l_num | integer, 1 ... count of lines of di | |
| c_num | integer, 1 ... count of columns of di | |
| name | string, the name for the new button | |
| function | string, the name of the macro, which will be executeded on clicking the new button | |
proc () = addknn(d, i, j)
data=getdata(d, i, j, 1)
kval=readvalue("Please enter knn-parameter:", rows(data)/10)
knnline=data[,1]~knn(data[,2], kval)
setmaskp(knnline, 0, 0, 0)
setmaskl(knnline, (1:rows(knnline))', 0, 1, 1)
adddata(d, i, j, knnline)
endp
di=createdisplay(1, 1)
x=1:100
y=sin(x/20)+uniform(100, 1)/10
show(di, 1, 1, x~y)
addbutton(di, 1, 1, "Add knn", "addknn(di, 1, 1)")
First you see the original dataset and a new button "Add knn" in the display window. After pressing this new button you will be asked for the knn-parameter. After providing it, the knn-smoothed version of the data will be added to the graphic as a line.
| Group: | Plot Manipulation |
| See also: | createdisplay show |