[scilab-Users] plotting date on x-axis

Francis Drossaert Francis.Drossaert at pgs.com
Wed Aug 27 18:18:23 CEST 2008


Hi Simon,

Not sure how to solve your problem completely, but I can give you a
suggestion. The x-ticks labels are strings and not numbers. Even if you
give numbers as you did, Scilab converts them to strings.

So what you could do is:
- get the handle of the axis. For example with h = gca()
- get the tick data: v1 = h.x_ticks.data
- convert this list into a string vector: for example v2 =
string(datavec(v1))
- and change h.x_ticks.labels = v2

I have not tested this but I think it should give you ideas how to
proceed. Note that the string vector has be the same length as the
number of ticks which does not have to be . Creating the string vector
from the serial dates and make it look nice could be a bit nasty.

Cheers,

Francis


-----Original Message-----
From: simon.elfert at web.de [mailto:simon.elfert at web.de] 
Sent: 27 August 2008 16:51
To: users at lists.scilab.org
Subject: [scilab-Users] plotting date on x-axis

Hi everybody,

I want to plot some timeseries where the x-ticks are dates (for example
"Nov. 1987" or "1.11.87").
That's where I am today...
forum
-------------
dt = datenum(y, m, d);      // y, m, d are vectors with information on 
year, month and day
all = [dt, data1, data2, data3];                  // data1-3 are 
data-vectors
-------------

till here I get:

-------------
all=
    724216.    6.6894479    6.6952958    0.20484   
    724217.    7.8806429    8.1755199    0.21636   
    724218.    9.0097742    10.1717      0.22731   
    724219.    9.3107634    11.451789    0.2525200 
    724220.    9.3775043    12.343613    0.3197800 
    724221.    9.3765812    12.939786    0.4009100 
    724222.    9.2700891    13.249661    0.5409700 
    724223.    9.1931381    13.444237    0.5119000 
    724224.    9.0925598    13.484509    0.47847
------------

when I plot that ( plot(all(:,1), [all(:,2), all(:,3), all(:,4)]) ), I
only get the serial dates (first column) on the x-axis.

Do you, how I could go on? I guess I need something like what is
datetick for matlab (found that expression on my research through the
net).

Thank you,
Simon

This email and any files contained therein is confidential and may contain privileged information.  If you are not the named addressee(s) or you have otherwise received this in error, you should not distribute or copy this e-mail or use any of its content for any purpose. Please notify the sender immediately by e-mail if you have received this e-mail in error and delete it from your system



More information about the users mailing list