Hello, So, I spotted one error, and I now understand the arect parameter for xsetech().
The following code is somewhat better: at least the x-axes are well placed at the bottom. Unfortunatelly, the y-axis is still misplaced. function []=break_axis(X, Y, minbreakX, maxbreakX, breaksize) // draw the curve in two separated intervals // [min(X) ; minbreakX] and [maxbreakX ; max(X)] // X is a sorted vector of reals // Y is a vector of reals of the same size as X // breaksize is the width of the break expressed as a fraction of one // // defining the subwindows bool1 = (X <= minbreakX); bool2 = (X >= maxbreakX); sizeX1 = minbreakX - X(1); sizeX2 = X($) - maxbreakX; invfullsizeX = 1/((1 + breaksize)*(sizeX1 + sizeX2)); minY1 = min(Y(bool1)); maxY1 = max(Y(bool1)); sizeY1 = maxY1 - minY1; minY2 = min(Y(bool2)); maxY2 = max(Y(bool2)); sizeY2 = maxY2 - minY2; maxY = max(Y); minY = min(Y); invfullsizeY = 1/(maxY - minY); rect_for_xsetech1 = [0, 1 - maxY1*invfullsizeY,... sizeX1*invfullsizeX, sizeY1*invfullsizeY]; rect_for_xsetech2 = [sizeX1*invfullsizeX + breaksize,... 1 - maxY2*invfullsizeY, sizeX2*invfullsizeX, sizeY2*invfullsizeY]; arectvalue = 1/8; [Yi, Ya, npY] = graduate(min(Y), max(Y)); [X1i, X1a, npX1] = graduate(X(1), max(X(bool1))); rectX1 = [X1i, Yi, X1a, Ya]; Xtics1 = linspace(X1i, X1a, npX1); [X2i, X2a, npX2] = graduate(min(X(bool2)), X($)); rect2 = [X2i, Yi, X2a, Ya]; Xtics2 = linspace(X2i, X2a, npX2); // drawing the left part : if maxY1 == maxY then arectYvector = [arectvalue, 0] else arectYvector = [0, arectvalue] end arectvector = [arectvalue, 0, arectYvector]; xsetech(rect_for_xsetech1, arect = arectvector); plot(X(bool1), Y(bool1)); axis1 = gca(); axis1.axes_visible=["off", "off", "off"]; axis1.box="off"; drawaxis(x=Xtics1, y=minY - sizeY1*arectYvector(1), dir="u", tics="v"); // drawing the right part : if maxY2 == maxY then arectYvector = [arectvalue, 0] else arectYvector = [ 0, arectvalue] end arectvector = [0, arectvalue, arectYvector]; xsetech(rect_for_xsetech2, arect = arectvector); plot(X(bool2), Y(bool2)); axis2 = gca(); axis2.axes_visible=["off", "off", "off"]; axis2.box="off"; drawaxis(x=Xtics2, y=minY - sizeY2*arectYvector(1), dir="u", tics="v"); // drawing the Y axis xsetech([0, 0, 1, 1], arect = arectvalue*[1, 1, 1, 1]); Ytics = linspace(Yi, Ya, npY); Yticscoord = Ytics./(Ya - Yi); Yticslabels = string(Ytics); finalaxisY = drawaxis(x=0, y=Yticscoord, dir="l", tics="v"); finalaxisY.tics_labels=Yticslabels; endfunction // test program clf(); X=0:10; Y = X.^2; break_axis(X, Y, 3, 5, 0.1); -- Christophe Dang Ngoc Chan Mechanical calculation engineer This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users