[Scilab-users] Fwd: plotxxyyy

Frieder Nikolaisen Frieder.Nikolaisen at student.hs-rm.de
Wed Oct 12 14:01:02 CEST 2016


 

Hello everybody, 

I did solve the Problem with showing only 10 line
numbers, by using IF. 

printer=1

for k=1:A_size(1,1) //Beschriftung

IF K>A_SIZE(1,1)*(PRINTER/10) THEN 
 printer = printer + 1

xstring(x(k),y3(1),string(k)) 
 // xstring(x,y,str,[angle,[box]])
 end

set(handles.Anzeige, 'string', 'Diagrammbeschriftung ' + string(k) + '
von ' + string(A_size(1,1)))
end

The line numbering is connected to the
y-axis. How can I move the lattering aboth the plot (or at least the
bottom, next to the x-axis)? (attached plot:
subplot_with_line_number_2_tenth.gif)

About Jens help: 

I attached
three plots: the stacks Picture are with the Code of Jens. Stacking is
really nice, but I do not need every line number. With 921 data Points,
it is already unreadable again. But thanks for your ideas, the Code is
great for learningn anyway. 

Cheers

Frieder 

On 2016-10-12 11:48,
Jens Simon Strom wrote: 

> Hello Frieder,
> Your plots look better now.
You can avoid overlapping of measurement numbers by sawtooth stacking
them. See example code below.
> 
> xdel();
> //Generating dummy
measurements x,y
> dx=0.5:50;
> x=cumsum(dx);
> y=sind(x);
>
nM=length(x);//number of measurements
> plot(x,y,'r')
> plot(x,y,'b+')
>
//Plotting the measurement numbers in stacks to avoid overlapping 
>
nstack=6;//number of stacked measurement numbers
> hstack=0.2;//height
of measurement number stack (relative to window height)
> ybase=-0.9;
//base ordinate for measurement numbers
> yspan=max(y)-min(y);
> for
m=1:nM//measurement number
>
xstring(x(m),ybase+(modulo(m,nstack)-1)*hstack*yspan/nstack,string(m))
>
end
> Kind regards
> Jens
>
------------------------------------------------------------------------------------------------------------------------------
>

> Am 12.10.2016 10:52, schrieb Frieder Nikolaisen: 
> 
>> Hello, 
>>

>> thank you for all the feedback and help. It's really great. 
>> 
>>
I used the idea of Jens Simon Strom combined with some help from last
week: 
>> 
>> //Datensätze 
>> x1 = (A(:,1) - A(1,1)) * 24 * 3600;
>> y1
= A(:,y_1);
>> y2 = A(:,y_2);
>> y3 = A(:,y_3);
>> drawlater()
>> 
>>
subplot(3, 1, 1)
>> co = color("green"); 
>> plot2d(x1, y1, co);
>> a =
gca();
>> b.font_color = co; 
>> a.foreground = co;
>>
ylabel(string(kT(y_1)),"color",co)
>> a.x_location = 'top';
>> 
>>
subplot(3, 1, 2)
>> co = color("blue"); 
>> plot2d(x1, y2, co);
>> b =
gca();
>> b.font_color = co; 
>> b.foreground = co;
>>
ylabel(string(kT(y_2)),"color",co)
>> b.axes_visible(1) = "off"; 
>>
//b.marings = [0.1 0.1 0.3 0.5]; 
>> //b.filled = "off"; 
>> subplot(3,
1, 3)
>> co=color("red");
>> plot2d(x1, y3, co); 
>> c = gca(); 
>>
c.font_color = co; 
>> c.foreground = co; 
>> //c.axes_visible(1) =
"off"; 
>> ylabel(string(kT(y_3)),"color",co)
>> //xlabel(string('Zeit
[Sekunden]'), co)
>> x= (A(:,1) - A(1,1)) * 24 * 3600;
>> for
k=1:A_size(1,1) //Beschriftung
>> xstring(x(k),x(1),string(k)) // x(1)
always 0
>> // xstring(x,y,str,[angle,[box]])
>> disp(x(1))
>> end
>>
//c.marings = [0.1 0.1 0.5 0.3]; 
>> //c.filled = "off"; 
>> 
>>
drawnow()
>> 
>> The printed plots are attached. I did plot different
paramters, as I can choose then in my GUI.
>> 
>> That works well: 
>>

>> * Three plots, having the same x axis. 
>> * x axis on the top and
bottom
>> * Line NUMBERS FITTING THE X AXIS. 
>> 
>> That does not work:

>> 
>> * showing a FEW LINE NUMBERS only, for reading (best case:
Fitting the automatic shown times in sec
>> 
>> Problem: I cannot tell,
how many datapoints there are going to be. So it mus be choosen
automaticly. 
>> 
>> Best regards 
>> 
>> Frieder 
>> 
>> On 2016-10-11
21:04, Samuel Gougeon wrote: 
>> 
>>> Hello,
>>> 
>>> Le 11/10/2016
14:46, Rafael Guerra a écrit : 
>>> 
>>>> Hi, 
>>>> 
>>>> I was not able
to follow the whole discussion
>>> Neither did i,
>>> 
>>>> but
concerning your subplot challenge: "_… I cannot add a second x-axis in a
subplot by newaxis(). How to add a x-axis by using subplot?_" and your
last example, 
>>>> 
>>>> Couldn't you add a 4th subplot at the bottom
in order to plot the 2ndx-axis (say by plotting only zeros)?
>>> .
>>>
Why not using drawaxis() as already suggested? drawaxis() is made for
this kind of situation.
>>> In this thread, no logarithmic axis is
involved. So i do to catch the reason of ignoring drawaxis().
>>> 
>>>
By the way, IMO, a drawing of what exactly is required would be clearer
than hundred of lines of description, with schematic curves, axes,
arrows linking curves to their multiple axes in x and y.
>>> 
>>> BR
>>>
Samuel Gougeon
>> 
>> _______________________________________________
>>
users mailing list
>> users at lists.scilab.org
>>
http://lists.scilab.org/mailman/listinfo/users

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161012/450c8d97/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subplot_with_line_number_1_stacks.gif
Type: image/gif
Size: 8609 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20161012/450c8d97/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subplot_with_line_number_2_stacks.gif
Type: image/gif
Size: 10946 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20161012/450c8d97/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subplot_with_line_number_2_tenth.gif
Type: image/gif
Size: 10016 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20161012/450c8d97/attachment-0002.gif>


More information about the users mailing list