[Scilab-users] Axis break with Scilab ?
Rafael Guerra
jrafaelbguerra at hotmail.com
Tue Nov 22 15:18:18 CET 2016
Hi Antoine,
Thanks for sharing this interesting topic.
Please check a quick brute force solution below, that needs further polishing.
In particular, the grid display should be improved.
// Multiple axis breaks in Scilab (1st brute force attempt)
// START OF CODE
clf();
clear;
x0=[1:10 20:25 60:100]; // sorted input x0 but with breaks
y0= sin(x0);
dxbreak= 1.1; // adjust this threshold to define breaks
dxtick = 10; // plot ticks every dxtic
k=1;
xb= list();
yb= list();
xb(1) = x0(1);
yb(1) = y0(1);
for i=1:length(x0)-1
if abs(x0(i+1)-x0(i)) < dxbreak then
xb(k)= [xb(k) x0(i+1)];
yb(k)= [yb(k) y0(i+1)];
else
k= k+1;
xb(k) = x0(i+1);
yb(k) = y0(i+1);
end
end
ymin = min(y0)-0.1*stdev(y0);
xn=1;
for i=1:k
xi = xn:xn+length(xb(i))-1;
val1 = xb(i)(1):dxtick:xb(i)($);
if val1($)<>xb(i)($) then val1=[val1 xb(i)($)]; end
xaxis = linspace(xi(1),xi($),length(val1));
plot(xi,yb(i))
// TODO: improve grid display
xgrid(color("grey70")); //a better grid style:
a = gca();
a.grid_style=[8 8];
drawaxis(x=xaxis,y=ymin,dir='d',tics='v', val=string(val1))
xn = xn +length(xb(i));
end
f=gcf();
f.children.axes_visible = ["off","on","on"]
//END OF CODE
Kind regards,
Rafael
-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Antoine Monmayrant
Sent: Tuesday, November 22, 2016 1:31 PM
To: users at lists.scilab.org
Subject: [Scilab-users] Axis break with Scilab ?
Hi all,
I just got a question from one of my colleagues: "Is this possible to get axis breaks when plotting with Scilab?"
(ie a plot where a bit of the scale in x, y or even both is missing, see : http://www.originlab.com/doc/Tutorials/Multiple-Axis-Breaks ).
As far as I know, I don't see any direct way to do it.
Am I wrong?
As for workaround, I think one could achieve similar results with subplots and visible/hidden axis, but it would require a bit of overhead ...
Cheers,
Antoine
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
More information about the users
mailing list