//THIS FUNCTION WILL CREATE A VARIOMETER LIKE DISPLAY OF THE INPUT DATA // //var1: 1xn vector --> data to be displayd //var2: string --> data unit // in comparison with "variometer.sci" this display will show a moving y-axis, // while the xpoly-line stays in the middle of the display. function HeadAlt (X, Xunit, Y, Yunit); END = max(size(X)); fignr = 1010; // use big numbers, so normal figures won't be affected f = figure(fignr); delmenu(fignr,'Datei'); delmenu(fignr,'Zusatzprogramme'); delmenu(fignr,'Editieren'); delmenu(fignr,'?'); toolbar(fignr,'off'); f.background = 1; // black background f.figure_size = [300 300]; f.figure_name = 'Heading vs Altitude'; f.figure_position = [700 300]; x = 90; y = 100; // <-- you may set the scale borders here w = 50; // <-- use "w" to set the x-postion of the x-axis labe h = 10; // <-- use "h" to set the y-position of they-axis label // display actual data for i=1:END; drawlater(); xpoly([X(i) X(i)],[Y(i)-y/2 Y(i)+y/2],'lines',1); xpoly([X(i)-x/2 X(i)+x/2],[Y(i) Y(i)],'lines',1); a = gca(); a.x_location = "bottom" a.y_location = "right"; a.margins = [0.2,0.2,0.2,0.2]; a.axes_visible = ["on","on","off"]; a.data_bounds = [X(i)-x, Y(i)-y; X(i)+x, Y(i)+y]; a.tight_limits = "on"; e1 = a.children(1); e1.thickness = 2; e2 = a.children(2); e2.thickness = 2; a.foreground = 7; // normal display = yellow a.font_foreground = 7; a.font_size = 3; a.x_label.font_foreground = 7; a.x_label.text = Xunit; a.x_label.font_angle = 0; a.x_label.font_size = 2; a.x_label.position = [X(i)-x-w Y(i)-y]; a.y_label.font_foreground = 7; a.y_label.text = Yunit; a.y_label.font_angle = 0; a.y_label.font_size = 2; a.y_label.position = [X(i)+x Y(i)+y+h]; a.ticks_format = ["%d","%d",""]; // a.sub_ticks = [4,1] drawnow(); // for checking purpose // mprintf('value = %.2f, lower scale = %.2f, upper scale = %.2f \n', data(i),data(i)-y,data(i)+y); tstep = 50; xpause(tstep*1000); // xpause counts in microseconds, tstep is for milliseconds, thatswhy factor 1000 if i < END delete(e1); delete(e2); end end endfunction