[Scilab-users] display grid but not the axis
Rafael Guerra
jrafaelbguerra at hotmail.com
Thu Oct 13 15:34:31 CEST 2016
Hi Frieder,
The code below draws the missing vertical grid when there are no x-axis displayed on the subplot (see picture attached):
x1 = (-10:0.5:10)';
y1 = sin(x1);
y2= 5*cos(x2);
y3= y2/2+y1;
clf()
subplot(3,1,1)
plot2d(x1,y1,color('red'),strf="020"); //no box surrounding plot
a=gca();
a.x_location = 'top';
a.axes_visible = ['on','on'];
xgrid;
subplot(3,1,2)
plot2d(x1,y2,color('blue'),strf="020"); ////no box surrounding plot
a=gca();
a.axes_visible = ['off','on'];
xgrid;
x = [a.data_bounds(1,1),a.data_bounds(2,1)];
y = [a.data_bounds(1,2),a.data_bounds(2,2)];
x = (x(2)-x(1))*a.x_ticks.locations + x(1);
n= length(x);
for i=1:n
xpoly([x(i),x(i)],y);
e=gce();
e.line_style=3;
end
subplot(3,1,3)
plot2d(x1,y3,strf="020")
a=gca();
a.axes_visible = ['on','on'];
xgrid;
Regards,
Rafael
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Friede
r Nikolaisen
Sent: Thursday, October 13, 2016 2:05 PM
To: mailto:users at lists.scilab.org
Subject: [Scilab-users] Fwd: Re: Fwd: plotxxyyy
Dear community,
thank you for you support. I get now wonderful plots.
There is still a feature missing: Plot two has not x grid. How to add a grid without a axis? (I tried a bit with newaxis... no success)
subplot(3, 1, 2)
co = color("blue");
plot2d(x1, y2, co);
b = gca();
b.font_color = co;
b.foreground = co;
b.axes_visible(1) = "off"; xgrid(co, 1, 10)
This code works well now:
subplot(3, 1, 3)
co=color("red");
plot2d(x1, y3, co);
xgrid(co, 1, 10)
c = gca();
c.font_color = co;
c.foreground = co;
c.data_bounds = [min(x1),min(y3); max(x1),max(y3)+(max(y3)-min(y3))*0.45]
//c.axes_visible(1) = "off";
ylabel(string(kT(y_3)),"color",co)
xlabel('Sekunden')
x= (A(:,1) - A(1,1)) * 24 * 3600;
//Input parameters for plotting the measurement numbers with optional gaps and stacking to avoid overlapping
nstack=5;//maximum number of stacked measurement numbers
hstack=0.3;//height of measurement number stack (relative to window height)
ybase=max(y3)*1; //base ordinate for measurement numbers
yspan=max(y3)-min(y3);
plot(x1(M),y3(M), 'ko') // fügt schwarze dots hinzu
for m=1:length(M) //Beschriftung
xstring(x1(M(m)),ybase+(modulo(M(m),nstack))*hstack*yspan/nstack,string(M(m)))
set(handles.Anzeige, 'string', 'Diagrammbeschriftung ' + string(k) + ' von ' + string(A_size(1,1)))
end
If I have a few hours nothingelse to do, I will try to solve the prolbem with Denis sparse function. With out using a for loop, it will be faster.
Best regards
Frieder
PS: I wanted to send two plots, but they are 111kB. I plead for a higher limit.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grid_with_no_axis.gif
Type: image/gif
Size: 14202 bytes
Desc: grid_with_no_axis.gif
URL: <https://lists.scilab.org/pipermail/users/attachments/20161013/3a83356f/attachment.gif>
More information about the users
mailing list