[Scilab-users] Fwd: plotxxyyy

Frieder Nikolaisen Frieder.Nikolaisen at student.hs-rm.de
Thu Oct 6 15:06:51 CEST 2016


Hello,

to Jens: ich habe Fortschritte gemacht, bin dennoch nicht zum Ergebnis 
gekommen.

I will write about the problem, in English:

1. Attached are two plots. The 16 line plot shows the Dates. But even 
with just 16 lines, it's not easy to read, as there are to many Dates 
ploted. How can I reduce the number?
2. In the plot with 1695 lines, there are no numbers anymore. I used 
the same code with the same data type, having the 16 first line in 
common.
3. Which paramter does change the color of plot and date?
4. I have these blue line on the x axis, how can I turn it off?
5. I would like to implement a checkbox, where the user can choose 
between date and line number. How to print the line number? There are 
more seconds as lines, so with just chaning the string, it does not fit.

Thank you very much for the prevous help.


The not running Code:

     my_handle = scf(100000);
     clf(my_handle);

     // Preparing data
     x=((-A(:,1)+A(A_size(:,1))))*24*3600 //offset, time measured in 
seconds, FN
//    x  = A(:,1);            //Serial Date Number    geändert durch FN
     y2 = A(:,y_2);            //              geändert durch FN
     y3 = A(:,y_3)             //        geändert durch FN


     drawlater()
     // demo_viewCode("plotyyy.dem.sce");

     // Axis y1
     y1=A(:,y_1);              //              geändert durch FN
     plot2d(x,y1)
     xtitle([gettext(string(kT(y_1)) +  string(kT(y_2)) + 
string(kT(y_3)));" "],..
     gettext("Serial Date Numbers"),gettext(string(kT(y_1))));    // 
geändert durch FN

     // Axis y2
     c=color("blue");
     na=newaxes();
     na.foreground=c;
     na.font_color=c;
     plot2d(x,y2,style=c)
     ylabel(string(kT(y_2)),"color",[0 0 1]) // geändert durch FN
     na.children(1).children(1).thickness=2;
     na.filled="off";
     na.axes_visible(1)="off";
//    na.axes_reverse(2)="on";
     na.y_location="middle";

     // Axis y3
     c=color("red");
     na=newaxes();
     na.foreground=c;                        // Axis and ticks color
     na.font_color=c;                        // Labels's color
     plot2d(x,y3,style=c);
     ylabel(string(kT(y_3)),"color",[1 0 0]) // geändert durch FN
     na.filled="off";                        // Transparent background, 
letting the first plot appearing
     na.axes_visible(1)="off";               // Masking the x axis 
(useless overlay)
     na.y_location="right";                  // Y axis on the right side
     na.children(1).children(1).thickness=2; // Curve thickness

     //Secound x axis, by Frieder Nikolaisen supported by Jens Simon 
Strom via Scilab Mailinglist

     drawnow()

dn=A(:,1)
A_size=size(A)
fake=zeros(A_size(1,1),1)
disp(A_size)
dv=datevec(A(:,1))
//dv(:,1)=dv(:,1)-2000//two digits only
     x=((-A(:,1)+A(A_size(:,1))))*24*3600;//offset,time measured in 
seconds
plot(x,fake) // with date as YY.MM.DD.HH.MM.SS
     na.filled="off";                        // Transparent background, 
letting the first plot appearing
     na.axes_visible(1)="off";               // Masking the x axis 
(useless overlay)
     na.y_location="right";                  // Y axis on the right side
     na.children(1).children(1).thickness=0; // Curve thickness
for k=1:A_size(1,1)  //Beschriftung
xstring(x(k),x(1),string(round(dv(k,:))'))
end


     // DEMO END
// mclose(plotyyy)

// endfunction

// demo_plotyyy();
// clear demo_plotyyy;

// Code von Samuel GOUGEON endet

set(handles.Anzeige, 'string','Ausgangsdiagramm erstellt')

endfunction






Best regards
Frieder






Am 06.10.2016 11:03, schrieb Jens Simon Strom:
> Hallo Frieder,
>  konnte der Ansatz mit xstring() für die Zeitachse (s. u.) dein
> Problem lösen?
>  MfG
>  Jens
>  -----------------------
>
> Am 04.10.2016 10:38, schrieb Jens Simon Strom:
>
>> Hallo Frieder,
>> I mean a diagram with _one_ y-axis quantified by _one_ numeric
>> _scale_.
>>
>>  The x-axis could be the automatically generated one showing the
>> serial date number, advantageously shortened by an adequate offset.
>> The YY.MM.DD.HH.MM.SS information could be accomodated at the bottom
>> of the diagram by means of xstring(). The following minimal example
>> my explain the approach.
>>
>> //dummy data
>> yr=[2016]*ones(1,5); mh=10*ones(yr);
>>
>> dy=4*ones(yr); hr=10*ones(yr); mn=11*ones(yr); sd=[41:45];
>> dn=datenum(yr,mh,dy,hr,mn,sd)
>> dv=datevec(dn)
>> dv(:,1)=dv(:,1)-2000//two digits only
>> xdel();
>> x=(dn-dn(1))*24*3600;//offset,time measured in seconds
>> y=x;//dummy data
>> plot(x,y,'o-') // with date as YY.MM.DD.HH.MM.SS
>> for k=1:length(dn)//Beschrift
>> xstring(x(k),x(1),string(round(dv(k,:))'))
>> end
>>
>> Kind regards
>> Jens
>>
> 
> ----------------------------------------------------------------------------------------------------------
>>
>> Am 04.10.2016 07:43, schrieb Frieder Nikolaisen:
>>
>>> Hello togehter,
>>>
>>> thank you for your answers. I do have to plot again and again for
>>> choosing the best time interval.
>>>
>>> Jens, what do you mean with using a single diagram? A diagram
>>> with one x and one y axis? And writing n/10^3 U/min) might look
>>> nicer, bit is not solving the problem of having the two needed
>>> information on the x axis: Time in YY.MM.DD.HH.MM.SS and the line
>>> in the Matrix.
>>>
>>> Best regards
>>> Frieder
>>>
>>> Am 30.09.2016 16:33, schrieb Jens Simon Strom:
>>>
>>>> Dear Frieder,
>>>>  My first reflex is to dodge the questions you are asking and
>>>> to use a
>>>> simpler approach instead:
>>>>
>>>>  Call the y-axis 'n/(10^3U/min), P/MW, a/(10m/s^2)' and plot
>>>> the
>>>> values into one SINGLE diagram over 't/h' which is calculated
>>>> as
>>>> (T-int(T))*24. Note that dividing the quantity by its unit
>>>> gives the
>>>> number shown at the axis. This is a widely accepted convention
>>>> to draw
>>>> axes and clearer than 'P in MW' oder 'P [MW]'. I think the
>>>> diagram
>>>> would look quite nice.
>>>>
>>>>  Regards
>>>>  Jens
>>>>  -------------------------------------------------------
>>>>
>>>> Am 30.09.2016 13:23, schrieb Frieder Nikolaisen:
>>>>
>>>>> Dear Jens,
>>>>>
>>>>> there is not much to be confused about. I have attached my
>>>>> Diagramms with that Code but real data. The mininmal example
>>>>> is just
>>>>> crap, because of the random Matrix A.
>>>>>
>>>>> The Grafik-Fenster Nummer 100000 is only for choosing the
>>>>> Intervall
>>>>> of intrest. The 100001 is the detail to look at. It's just
>>>>> about a
>>>>> vehicle dooing shunting. I will include the possiblilty to
>>>>> choose
>>>>> the paramater you want to look at. Right now turn per minute
>>>>> and
>>>>> power arn't that useful.
>>>>>
>>>>> Best regards
>>>>> Frieder
>>>>>
>>>>> Am 30.09.2016 11:48, schrieb Jens Simon Strom:
>>>>>
>>>>>> Dear Frieder,
>>>>>> It looks like you would like to put plenty of information
>>>>>> into
>>>>>> one
>>>>>> single diagram. This tends to become confusing and
>>>>>> difficult to
>>>>>> read.
>>>>>> It would help your helpers if you enclosed a (manual)
>>>>>> sketch how
>>>>>> the
>>>>>> final result of your visualisation should look like. And
>>>>>> perhaps
>>>>>> that
>>>>>> could trigger you to review the layout of what you plan to
>>>>>> plot.
>>>>>> Regards
>>>>>> Jens
>>>>
>>>>
>>>
>>
> 
> ------------------------------------------------------------------------------------
>>>>
>>>>
>>>>>> Am 30.09.2016 11:27, schrieb Frieder Nikolaisen:
>>>>>>
>>>>>>> I did forgott one Point:
>>>>>>>
>>>>>>> My data Looks like:
>>>>>>>
>>>>>>> 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
>>>>>>> ...
>>>>>>> 04.04.2012 12:13:15.910 46482.9710 15.10 1344.19 0.49 1 1
>>>>>>> 1 1 1
>>>>>>> 0 1
>>>>>>>
>>>>>>> I want to plot some paramters over the time. I used
>>>>>>> datenum -
>>>>>>> but then the Diagramm cant be read easy. How could I
>>>>>>> print the
>>>>>>> time instead of Serial date number on the axes as well as
>>>>>>> the
>>>>>>> row number? (plotxxyyy x1=real time in DD MM YY HH MM SS,
>>>>>>> x2=row
>>>>>>> number and yyy)
>>>>>>>
>>>>>>> I do read These file in a Matrix, I add some more
>>>>>>> paramters and
>>>>>>> print:
>>>>>>>
>>>>>>> Zeit Distanz Geschwindigkeit 1 Drehzahl
>>>>>>> Getriebeausgangsleistung [Watt] Zugkraft [N]
>>>>>>> Beschleunigung
>>>>>>> [m/s^2] Cv-Druck Richtung Lokbremse anlegen Lokbremse
>>>>>>> lösen
>>>>>>> Zugbremse anlegen Zugbremse lösen Kupplung betätigt
>>>>>>> Bremsen
>>>>>>> aktiv
>>>>>>> 734962.404654 46476.494 0.00 1150.71 141700 0 0.00 0 0 0
>>>>>>> 0 1 0
>>>>>>> 0
>>>>>>> 734962.404900 46476.494 0.00 1059.06 110500 0 0.00 0 0 1
>>>>>>> 0 1 0
>>>>>>> 0
>>>>>>> ...
>>>>>>>
>>>>>>> For beeing used in a secound Programm.
>>>>>>>
>>>>>>> Best regards
>>>>>>>
>>>>>>> -------- Originalnachricht --------
>>>>>>> Betreff: [Scilab-users] plotxxyyy
>>>>>>> Datum: 30.09.2016 11:17
>>>>>>> Absender: Frieder Nikolaisen
>>>>>>> <Frieder.Nikolaisen at student.hs-rm.de> [1] [1]
>>>>>>> Empfänger: Users mailing list for Scilab
>>>>>>> <users at lists.scilab.org> [2] [2]
>>>>>>> Antwort an: Users mailing list for Scilab
>>>>>>> <users at lists.scilab.org> [3] [3]
>>>>>>>
>>>>>>> Hello everybody,
>>>>>>>
>>>>>>> with you help I got my programm so far running pretty
>>>>>>> well. Now
>>>>>>> I have trouble again with the plotting. I used the
>>>>>>> demos_gui
>>>>>>> plotyyy, but want now the plotxxyyy. How to implement xx?
>>>>>>> I
>>>>>>> attach my minimal example with a random Matrix, instead
>>>>>>> of the
>>>>>>> real one I use.
>>>>>>>
>>>>>>> This programm will be used at my theses. So I want to do
>>>>>>> correct quotes. I am used how to do this a text, but how
>>>>>>> is it
>>>>>>> done in a programm?
>>>>>>>
>>>>>>> I do get Errors, if I do not open the example plotyyy -
>>>>>>> is this
>>>>>>> really necessary?
>>>>>>> " plotyyy=uigetfile('plotyyy.dem.sce'); mopen(plotyyy) "
>>>>>>>
>>>>>>> Best regards
>>>>>>> Frieder Nikolaisen
>>>>>>>
>>>>>>> The minimal Code:
>>>>>>>
>>>>>>> //Write your callback for Diagramm here
>>>>>>>
>>>>>>> A=rand(15,50)
>>>>>>>
>>>>>>> //Dieser Code und geistiges Eigentum von Samuel GOUGEON
>>>>>>> wird
>>>>>>> geändert und angepasst von Frieder Nikolaisen (FN),
>>>>>>> bleibt in
>>>>>>> seinen Grundzügen jedoch erhalten
>>>>>>>
>>>>>>> // Scilab ( http://www.scilab.org/ [4] [4] ) - This file
>>>>>>> is part of
>>>>>>> Scilab
>>>>>>> // Copyright (C) 2010 Samuel GOUGEON
>>>>>>> // Copyright (C) 2010 - DIGITEO - Allan CORNET
>>>>>>> //
>>>>>>> // This file is released under the 3-clause BSD license.
>>>>>>> See
>>>>>>> COPYING-BSD.
>>>>>>>
>>>>>>> function demo_plotyyy()
>>>>>>>
>>>>>>> plotyyy=uigetfile('plotyyy.dem.sce') // hinzugefügt von
>>>>>>> FN
>>>>>>> (changed by Frieder Nikolaisen)
>>>>>>> mopen(plotyyy) // hinzugefügt von FN
>>>>>>>
>>>>>>> // DEMO START
>>>>>>> // A plotyyy() example:
>>>>>>> //http://bugzilla.scilab.org/show_bug.cgi?id=6070 [5] [5]
>>>>>>>
>>>>>>>
>>>>>>> my_handle = scf(100000);
>>>>>>> clf(my_handle);
>>>>>>>
>>>>>>> // Preparing data
>>>>>>> x = A(:,1); //Serial Date Number geändert durch FN
>>>>>>> (changed by
>>>>>>> Frieder Nikolaisen)
>>>>>>> y2 = A(:,5); //Leistung geändert durch FN
>>>>>>> y3 = A(:,7) //Beschleunigung geändert durch FN
>>>>>>>
>>>>>>> drawlater()
>>>>>>> demo_viewCode("plotyyy.dem.sce");
>>>>>>>
>>>>>>> // Axis y1
>>>>>>> y1=A(:,4); //Drehzahl geändert durch FN
>>>>>>> plot2d(x,y1)
>>>>>>> xtitle([gettext("Leistung, Drehzahl und
>>>>>>> Beschleunigung");"
>>>>>>> "],..
>>>>>>> gettext("Serial Date Numbers"),gettext("Drehzahl in
>>>>>>> U/min"));
>>>>>>> // geändert durch FN
>>>>>>>
>>>>>>> // Axis y2
>>>>>>> c=color("blue");
>>>>>>> na=newaxes();
>>>>>>> na.foreground=c;
>>>>>>> na.font_color=c;
>>>>>>> plot2d(x,y2,style=c)
>>>>>>> ylabel("Leistung in Watt","color",[0 0 1]) // geändert
>>>>>>> durch
>>>>>>> FN
>>>>>>> na.children(1).children(1).thickness=2;
>>>>>>> na.filled="off";
>>>>>>> na.axes_visible(1)="off";
>>>>>>> // na.axes_reverse(2)="on";
>>>>>>> na.y_location="middle";
>>>>>>>
>>>>>>> // Axis y3
>>>>>>> c=color("red");
>>>>>>> na=newaxes();
>>>>>>> na.foreground=c; // Axis and ticks color
>>>>>>> na.font_color=c; // Labels's color
>>>>>>> plot2d(x,y3,style=c);
>>>>>>> ylabel("Beschleunigung in m/s","color",[1 0 0]) //
>>>>>>> geändert
>>>>>>> durch FN
>>>>>>> na.filled="off"; // Transparent background, letting the
>>>>>>> first
>>>>>>> plot appearing
>>>>>>> na.axes_visible(1)="off"; // Masking the x axis (useless
>>>>>>> overlay)
>>>>>>> na.y_location="right"; // Y axis on the right side
>>>>>>> na.children(1).children(1).thickness=2; // Curve
>>>>>>> thickness
>>>>>>>
>>>>>>> drawnow()
>>>>>>>
>>>>>>> // DEMO END
>>>>>>> mclose(plotyyy)
>>>>>>>
>>>>>>> endfunction
>>>>>>>
>>>>>>> demo_plotyyy();
>>>>>>> clear demo_plotyyy;
>>>>>>>
>>>>>>> // Code von Samuel GOUGEON endet
>>>>>>>
>>>>>>> set(handles.Anzeige, 'string','Ausgangsdiagramm
>>>>>>> erstellt')
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> users mailing list
>>>>>>> users at lists.scilab.org [6] [6]
>>>>>>> http://lists.scilab.org/mailman/listinfo/users [7] [7]
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> users mailing list
>>>>>>> users at lists.scilab.org [8] [8]
>>>>>>> http://lists.scilab.org/mailman/listinfo/users [9] [9]
>>>>>>
>>>>>> _______________________________________________
>>>>>> users mailing list
>>>>>> users at lists.scilab.org [10] [10]
>>>>>> http://lists.scilab.org/mailman/listinfo/users [11] [11]
>>>>>
>>>>> _______________________________________________
>>>>> users mailing list
>>>>> users at lists.scilab.org [12]
>>>>> http://lists.scilab.org/mailman/listinfo/users [13]
>>>>
>>>> Links:
>>>> ------
>>>> [1] mailto:Frieder.Nikolaisen at student.hs-rm.de [14]
>>>> [2] mailto:users at lists.scilab.org [15]
>>>> [3] mailto:users at lists.scilab.org [16]
>>>> [4] http://www.scilab.org/ [17]
>>>> [5] http://bugzilla.scilab.org/show_bug.cgi?id=6070 [18]
>>>> [6] mailto:users at lists.scilab.org [19]
>>>> [7] http://lists.scilab.org/mailman/listinfo/users [20]
>>>> [8] mailto:users at lists.scilab.org [21]
>>>> [9] http://lists.scilab.org/mailman/listinfo/users [22]
>>>> [10] mailto:users at lists.scilab.org [23]
>>>> [11] http://lists.scilab.org/mailman/listinfo/users [24]
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org [25]
>>> http://lists.scilab.org/mailman/listinfo/users [26]
>
>
>
> Links:
> ------
> [1] mailto:Frieder.Nikolaisen at student.hs-rm.de
> [2] mailto:users at lists.scilab.org
> [3] mailto:users at lists.scilab.org
> [4] http://www.scilab.org/
> [5] http://bugzilla.scilab.org/show_bug.cgi?id=6070
> [6] mailto:users at lists.scilab.org
> [7] http://lists.scilab.org/mailman/listinfo/users
> [8] mailto:users at lists.scilab.org
> [9] http://lists.scilab.org/mailman/listinfo/users
> [10] mailto:users at lists.scilab.org
> [11] http://lists.scilab.org/mailman/listinfo/users
> [12] mailto:users at lists.scilab.org
> [13] http://lists.scilab.org/mailman/listinfo/users
> [14] mailto:Frieder.Nikolaisen at student.hs-rm.de
> [15] mailto:users at lists.scilab.org
> [16] mailto:users at lists.scilab.org
> [17] http://www.scilab.org/
> [18] http://bugzilla.scilab.org/show_bug.cgi?id=6070
> [19] mailto:users at lists.scilab.org
> [20] http://lists.scilab.org/mailman/listinfo/users
> [21] mailto:users at lists.scilab.org
> [22] http://lists.scilab.org/mailman/listinfo/users
> [23] mailto:users at lists.scilab.org
> [24] http://lists.scilab.org/mailman/listinfo/users
> [25] mailto:users at lists.scilab.org
> [26] http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plot_date_1695_lines.gif
Type: image/gif
Size: 20020 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20161006/af54e438/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_date_16_lines.gif
Type: image/gif
Size: 13970 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20161006/af54e438/attachment-0001.gif>


More information about the users mailing list