Octave plot on time/date x-axis

David Bateman David.Bateman at motorola.com
Tue Sep 16 03:04:46 CDT 2008


Bill Denney wrote:
> Ivan Sutoris wrote:
>   
>>> I would like to plot a data set that has dates and time in the x-axis. I
>>> have found the following code, but when I enter it i get a parse error:
>>> syntax error.
>>>
>>>  __gnuplot_set xdata time
>>>  __gnuplot_set timefmt "%d/%m"
>>>  __gnuplot_set format x "%b %d"
>>>     
>>>       
>> I think Octave no longer allows to directly access gnuplot, so these
>> commands won't work. I don't know if there is some simple way to have
>> dates as tick labels, but you can always set tick labels manually,
>> like this:
>>
>> data = [2 3 5 3.5 6];
>> datalabels = {'10/3/2008','10/4/2008','10/5/2008','10/6/2008','10/7/2008'};
>> % cell array
>> plot(data)
>> set(gca(),'xticklabels',datalabels)
>>     
> If you install the financial package, you can use the dateaxis command
> which likely does what you're wanting to do.
>
> Have a good day,
>
>   

How does dateaxis differ from the dateticks function?  Taking a quick 
look at the matlab help pages, I can see that much of a difference in 
them. Perhaps we should migrate dateaxis to Octave as the dateticks 
command and make dateaxis depend on dateticks?

Cheers
David



-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



More information about the Help-octave mailing list