[Scilab-users] Fwd: plotxxyyy

Frieder Nikolaisen Frieder.Nikolaisen at student.hs-rm.de
Tue Oct 11 11:04:23 CEST 2016


 

Dear Jens, 

yes, the plot_date_16_lines.gif Show real data, but
only a few lines of it. 

For two reasons, showing the datevec isn't a
good approach i asked for. Your tip to show the secounds instead of the
datenumber, solved the Problem to have a readalbe time. I use a first
diagramm for choosing the intervall I am going to process later on. For
the choosing of the time period, I have two butooms that Show two
different Diagramms. The first shows the entire time period and the
scound enlargest the choosen period of time. 

I choose the period by
tiping the start and finish line number in my gui. With the secounds
printed, I do not know the line number. So I have to try and print and
try and print. ... 

Why aren't the secounds the same as the line number
(data Point)? 

Because my data Looks like this: 

Zeit Distanz
Geschwindigkeit 1 Drehzahl Cv-Druck Richtung Lokbremse anlegen Lokbremse
lösen Zugbremse anlegen Zugbremse lösen Kupplung betätigt Bremsen aktiv

03.04.2012 08:49:20.090 46476.4940 0.00 478.61 0.53 0 0 0 1 0 0 0

03.04.2012 09:42:42.120 46476.4940 0.00 1150.71 0.24 0 0 0 1 0 0 0

03.04.2012 09:43:03.350 46476.4940 0.00 1059.06 0.24 0 1 0 1 0 0 0

03.04.2012 09:43:03.550 46476.4940 0.00 1059.06 0.24 0 1 1 1 1 0 0

03.04.2012 09:43:09.460 46476.4945 1.70 1059.06 0.24 0 1 1 1 1 0 0


Translate the header: time distance Speed Revolution Speed, .... 

The
time period between each data Point isn't the same. Once the locomotive
starts to operate, the programm does print line by line, each time a
paramter changes. If the locomotive stands a few hours around, the data
has a gap. 

But I want to print on one x axis the time in Secounds (or
maybe hours or days, depends on the period I have to process). On the
secound x-axis, I want to print the line number. On the attached
Diagramm, you see that there is a gap between secound 2000 and secound
3500. That one must to be seen in the Diagramm, but I want to know what
line is secound 2000 and what line is secound 3500, to maybe chosse the
time of Operation of the locomotive before These night break. 

The
question of datapoints is: They differ between a few tousand (50 000)
and a few millions. The Programm must be able to operate with booth. The
first Diagramm is going to Show me the entire time period of a few days.
Then I have a secound Diagramm. With the secound one, I choose by tiping
the start and finsih line number in my gui, the time period of my
Diagramm. Maybe one day. Then I have the data a Little big bigger, then
I do choose the hours of interet. That might be just one hour. Then I do
type the lines of this time period. 

In the end, I do print the choosen
time period in a new document, adding (calculating) a few more parametre
like traction. With the printed document, is for Simulation. 

My
approach now is. Plotting three Diagramm abooth each other. But I cannot
ad a secound x-axis in a subplot by newaxis(). How to add a x-axis by
using subplot? 

Thank you for your Support. 

Cheers 

Frieder 

(my
webmailing Programm changes my lettering to capalization by Default,
enyoing). 

How to copy the Code with the colours? 

0001
drawlater()
0002 
0003 subplot(3, 1, 1)
0004 co = color("green");
0005
plot2d(x1, y1, co);
0006 a = gca(); 
0007 a.font_color = co; 
0008
a.foreground = co;
0009 a.axes_visible(1)= "off";
0010
ylabel(string(kT(y_1)),"color",co)
0011 //a.y_location="right";
0012
//a.marings = [0.1 0.1 0.1 0.7];
0013 //a.filled = "off"; 
0014
subplot(3, 1, 2)
0015 co = color("blue"); 
0016 plot2d(x1, y2, co);
0017
b = gca();
0018 b.font_color = co; 
0019 b.foreground = co;
0020
ylabel(string(kT(y_2)),"color",co)
0021 b.axes_visible(1) = "off"; 
0022
//b.marings = [0.1 0.1 0.3 0.5]; 
0023 //b.filled = "off"; 
0024
subplot(3, 1, 3)
0025 co=color("red");
0026 plot2d(x1, y3, co); 
0027 c
= gca(); 
0028 //c.font_color = co; 
0029 //c.foreground = co; 
0030
//c.axes_visible(1) = "off"; 
0031
ylabel(string(kT(y_3)),"color",co)
0032 xlabel(string('Zeit
[Sekunden]'))
0033 //c.marings = [0.1 0.1 0.5 0.3]; 
0034 //c.filled =
"off"; 
0035 
0036 // Erstellt zweite x-Achse Problem: Kein newaxis im
subplot möglich
0037 //subplot(3,1,3);
0038 //c=newaxes(c) 
0039 //co =
color("blue"); 
0040 //plot2d(x1, y2, co);
0041 //c.font_color = co;

0042 //c.foreground = co;
0043 //c.axes_visible(2) = "off"; 
0044 
0045
drawnow()

Am 11.10.2016 09:45, schrieb Jens Simon Strom: 

> Dear
Frieder,
> Your diagram problem seems still to be pending. For further
assistance 
> it would be helpful if you answered a couple of
questions:
> 1. Does your attachment "plot_date_16_lines.gif" (your mail
06.10.2016 
> 15:06) show real time data?
> 2. Is the overlap of the
time labeling text colums (YY.MM.DD.hh.mm.ss) 
> the essential remaining
problem?
> 3. What is the maximum time interval (in seconds) you want to
accomodate 
> on the x-axis?
> 4. How many time points you want to
accomodate on the x-axis at most?
> 
> Regards
> Jens
>
---------------------------------------------------------------------------------------------------
>

> Am 10.10.2016 13:38, schrieb Frieder Nikolaisen:
> 
>> Dear Philipp,
thanks for you help. I tried to adopt your Code to my programm. No
success. There is a prolbem I should have metioned eralier. The time
between each datapoint has a different time period. So I cant print the
y-axis over the time and add a a secound x axis for the line of
document. I might stick to the plotxyyy. Best regards Frieder Am
10.10.2016 09:04, schrieb Philipp Mühlmann: 
>> 
>>> Dear Frieder, one
more comment. Instead of using "foo"-data, it might be more useful to
plot each graph several times. Otherwise the y-axes are not assosiated
with the data and you have to take more care about them. e.g.: //
display all graph on first x-axis plot2d(x1,y1); // and hide the y1-axis
plot2d(x1,y2); // and hide the y2-axis plot2d(x1,y3); // and hide the
y3-axis // plot the y-axis assosiated with the corresponding data
plot2d(x1,y1); // and hide the graph and the x1-axis and shift y1 to
desired locaion plot2d(x1,y2); // and hide the graph and the x1-axis and
shift y2 to desired locaion plot2d(x1,y3); // and hide the graph and the
x1-axis and shift y3 to desired locaion // plot the x2-axis assosiated
with the corresponding data plot2d(x2,y1); // and hide the graph and the
y1-axis and shift x2 to desired locaion best regards, Philipp 2016-10-09
2:58 GMT+02:00 Philipp Mühlmann <p.muehlmann at gmail.com [9][7]>: 
>>>

>>>> OK. Please find attached a sample that might help you. Note: It is
possible to draw only an axis without showing the corresponding data.
Hence: One can create some "fake" or "foo" data not displaying them, but
showing the corresponding axis. so using this principle, you can draw as
many axes as you like..and place them where you like. clc(); clear(all);
// all datashare same x axis // example: there are 1000 datapoints x1 =
linspace(1,1000,1000); // each graph has its own y-axis y1 = x1; y2 =
200*sin(1/20 * x1); y3 = sqrt(x1); // create fake x-values for y-axis
fake_x = zeros(1,length(x1)); y1_min = 0; // min-value for y1-axis
y1_max = 100; // max value for y1 axis y2_min = -2; // min-value for
y2-axis y2_max = 2; // max value for y2 axis y3_min = 10; // min-value
for y3-axis y3_max = 20; // max value for y3 axis // create 2nd x-axis
// example: the 1000 datapoints has been taken in 60 seconds x2_min = 0;
x2_max = 60; dx2 = x2_max - x2_min + 1 x2 = linspace(x2_min,x2_max,dx2);
// create fake data for x2 axis fake_y = zeros(1,length(x2)); f =
figure(); f.background = 8; drawlater() plot2d(x1, y1,1); plot2d(x1,
y2,2); plot2d(x1, y3,5); a = gca() a.axes_visible(2)="off"; a.margins =
[0.2 0.2 0.2 0.2]; // create y1 axis a1 = newaxes(); plot2d(fake_x, y1);
// for fake_x = 0 creates a line on the y1-axis // therefore the fake
data are not visible a1.children.children.visible = off; // hide fake
graph if nesessary to only show the axes a1.data_bounds =
[0,y1_min;1,y1_max]; // make x-coordinate start at 0 so that fake data
aling with y-axis a1.axes_visible(1)="off"; a1.filled="off";
a1.y_location="left"; a1.margins = [0.2 0.2 0.2 0.2]; // create y2 axis
a2 = newaxes(); c=color("blue"); a2.font_color=c; a2.foreground=c;
plot2d(fake_x, y2,c); // for fake_x = 0 creates a line on the y2-axis //
therefore the fake data are not visible a2.children.children.visible =
off; // hide fake graph if nesessary to only show the axes
a2.data_bounds = [0,y2_min;1,y2_max]; // set x-min to "0"...x_max does
not matter, since x-axis wont be shown a2.axes_visible(1)="off";
a2.filled="off"; a2.y_location="left"; a2.margins = [0.1 0.2 0.2 0.2];
// create y3 axis a3 = newaxes(); c=color("red"); a3.font_color=c;
a3.foreground=c; plot2d(fake_x, y3,c); // for fake_x = 0 creates a line
on the y3-axis // therefore the fake data are not visible
a3.children.children.visible = off; // hide fake graph if nesessary to
only show the axes a3.data_bounds = [0,y3_min;1,y3_max]; // set x-min to
"0"...x_max does not matter, since x-axis wont be shown
a3.axes_visible(1)="off"; a3.filled="off"; a3.y_location="right";
a3.margins = [0.1 0.2 0.2 0.2]; a3.axes_reverse = ["on","off","off"]; //
reverse x3 axis, since it is on the right side // create 2nd x-axis a4 =
newaxes(); c=color("black"); a4.font_color=c; a4.foreground=c;
plot2d(x2, fake_y,c); // for fake_y = 0 creates a line on the x2-axis //
therefore the fake data are not visible a4.children.children.visible =
off; // hide fake graph if nesessary to only show the axes
a4.data_bounds = [min(x2),0;max(x2),1]; a4.axes_visible(2)="off";
a4.filled="off"; a4.x_location="bottom"; a4.margins = [0.2 0.2 0.2 0.1];
drawnow() 2016-10-09 1:04 GMT+02:00 Frieder Nikolaisen
<Frieder.Nikolaisen at student.hs-rm.de [8][6]>: 
>>>> 
>>>>> Dear Philipp,
thank you, thats great. I will try it at work on monday. Actually, I do
have three plots sharing a common x axis and having three different y
axis. Why I do want to have two x axis is, to show to different times on
x. Once in secound, once in line of document. Best regards Frieder Am
08.10.2016 um 23:43 schrieb Philipp Mühlmann: 
>>>>> 
>>>>>> Dear
Frieder, I understand following: You want to plot 3 graphs into one
diagram. Basically each graph has its own x and y axis. Since for two
graphs the x-axis are the same, you want to have a diagram with two
x-axis and three y-axis Please find a code snipplet that will create
such a diagram. Best regards, Philipp clc(); clear(all); x1 =
linspace(1,10,10); x2 = linspace(0,100,101); x3 = x1; y1 =
linspace(1,10,10); y2 = sin(x2); y3 = sqrt(x1); drawlater() plot2d(x1,
y1); a1 = gca(); a1.x_location = "bottom"; a1.y_location = "left";
a1.margins = [0.2,0.2,0.2,0.2] // Axis y2 a2=newaxes(); c=color("blue");
plot2d(x2,y2,style = c); a2.font_color=c; a2.foreground=c;
a2.filled="off"; a2.x_location="bottom"; a2.y_location="right";
a2.margins = [0.2,0.2,0.2,0.1]; // shift axis relative to graphic window
a2.data_bounds = [0,-2.;100,2]; // change axis bounds, so that graph is
nicely placed in plotted area // Axis y3 a3=newaxes(); c=color("red");
plot2d(x3,y3,style = c); a3.font_color=c; a3.foreground=c;
a3.filled="off"; a3.x_location="bottom"; a3.y_location="left";
a3.data_bounds = [0,1;10,4]; a3.margins = [0.134 0.2 0.2 0.2]; //
display x3 to check overlapping of x1 and x3 tics; // if overlapping is
good enough, than hide x3 a3.axes_visible(1)="off"; drawnow() 2016-10-06
21:28 GMT+02:00 Jens Simon Strom <j.s.strom at hslmg.de [3][3]>: 
>>>>>>

>>>>>>> EDIT IN #3 Am 06.10.2016 18:20, schrieb Jens Simon Strom:

>>>>>>> 
>>>>>>>> Hallo Frieder, You ask many questions in one post. 1:
You just divide the (numerical) time interval into an adequate number of
points (which can be neatly accommodated) with linspace or : and plot
the corresponding time text colums via a for-loop. There is no need that
text times coincide with measured data. They only should be placed at
the correct locations. 3:You may not be familiar with how to get quick
help from Scilab: Just highlight the command plot2d or style here and go
to the help pages BY RIGHT MOUSE CLICK. 4: Highlight newaxes, foreground
5: I would postpone integrating a checkbox until everything else is to
your satisfaction. The rest of #5 is perhaps answered by #1. General
remarks * Do not ask many questions simultaneously. Attack them one by
one. You make it easier for yourself and the helpers. * Accompany your
questions by short examples which omit irrelevant ornaments. The code
you really write with the variables you really use is less appropriate
in most cases. * Begin to polish the results (color, line types, fonts,
fontsize, etc.) only as the last step in your work. At the beginning
accept what Scilab delivers to you. * Work the help pages. My painful
experience is that the polishing job often consumes more time (and
nerves) than the technical problem itself. Scilab is far from intuitive
in that respect. Kind regards, Jens
>>>>>>>
_______________________________________________ users mailing list
users at lists.scilab.org [1] [1]
http://lists.scilab.org/mailman/listinfo/users [2] [2]
>>>>>> -- In
Kanada is ka na da. Sonst wär Kanada Jemanda. There we have the salad.
_______________________________________________ users mailing list
users at lists.scilab.org [4]
http://lists.scilab.org/mailman/listinfo/users [5]
>>>>>
_______________________________________________ users mailing list
users at lists.scilab.org [6] [4]
http://lists.scilab.org/mailman/listinfo/users [7] [5]
>>>> -- In Kanada
is ka na da. Sonst wär Kanada Jemanda. There we have the salad.
>>> --
In Kanada is ka na da. Sonst wär Kanada Jemanda. There we have the
salad. Links: ------ [1] mailto:users at lists.scilab.org [10] [2]
http://lists.scilab.org/mailman/listinfo/users [11] [3]
mailto:j.s.strom at hslmg.de [12] [4] mailto:users at lists.scilab.org [13]
[5] http://lists.scilab.org/mailman/listinfo/users [14] [6]
mailto:Frieder.Nikolaisen at student.hs-rm.de [15] [7]
mailto:p.muehlmann at gmail.com [16]
>>
_______________________________________________ users mailing list
users at lists.scilab.org [17]
http://lists.scilab.org/mailman/listinfo/users [18]
> 
>
_______________________________________________
> users mailing list
>
users at lists.scilab.org
>
http://lists.scilab.org/mailman/listinfo/users

 capitalization [19]AE
[20] 

Links:
------
[1] mailto:users at lists.scilab.org
[2]
http://lists.scilab.org/mailman/listinfo/users
[3]
mailto:j.s.strom at hslmg.de
[4] mailto:users at lists.scilab.org
[5]
http://lists.scilab.org/mailman/listinfo/users
[6]
mailto:users at lists.scilab.org
[7]
http://lists.scilab.org/mailman/listinfo/users
[8]
mailto:Frieder.Nikolaisen at student.hs-rm.de
[9]
mailto:p.muehlmann at gmail.com
[10] mailto:users at lists.scilab.org
[11]
http://lists.scilab.org/mailman/listinfo/users
[12]
mailto:j.s.strom at hslmg.de
[13] mailto:users at lists.scilab.org
[14]
http://lists.scilab.org/mailman/listinfo/users
[15]
mailto:Frieder.Nikolaisen at student.hs-rm.de
[16]
mailto:p.muehlmann at gmail.com
[17] mailto:users at lists.scilab.org
[18]
http://lists.scilab.org/mailman/listinfo/users
[19]
http://dict.leo.org/ende/index_de.html#/search=capitalization&searchLoc=0&resultOrder=basic&multiwordShowSingle=on&pos=0
[20]
http://dict.leo.org/ende/index_de.html#/search=AE&searchLoc=0&resultOrder=basic&multiwordShowSingle=on&pos=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161011/99718de1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 11.10.16.gif
Type: image/gif
Size: 10440 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20161011/99718de1/attachment.gif>


More information about the users mailing list