Simple date and time plotting on x-axis

Hi all,
this is an attempt to wake up from an old dream where plotting data from time series will be straight forward in Scilab ! ( new feature development required)

As stated in this previous discussion with Samuel, when dealing with data from time series (y(t0), …y(t), not even regularly sampled in time, with t being universal date & time representation, like Sept. 19th 2023 09:05:00.023 UTC ) the need is to calculate in the figure object, appropriate x-ticks considering the way it will be displayed in the figure, depending on the time frame actually displayed, that’s to say it needs to be adapted if you show data covering 3 years, or 1 day and half or 2 minutes from a certain UTC date and time.

This is a frequent need when dealing with experimental data and new scilab users are frequently confused when trying to find a workaround. Especially there was in 2018 a strong limitation around the lack of callback function after resizing the figure or changing the zoom level.

From the users community, is there an interest to define further the requirements of such a new feature and to push it in the new Scilab development roadmap ?

Thank you for your comments,

David

Hello David,

A first step should be to precisely describe the expected behavior and the eventual rendering options. You could first create typical examples with manual processing of the ticks marks/ticks labels and make some screenshots, and propose the sketch of a rendering algorithm.
A second step should be to implement the above algorithm as a Scilab function accepting the Axes handle as argument and yielding the ticks positions/ticks labels.
The function call should be then triggered by a figure resize, this could be a proposal for a future release of Scilab, either by creating a new event handled by the eventhandler function, or by creating a new Axes field pointing to the above “user ticks fornatting” function to overload the actual internal ticks computation.

And last, IMHO the internal numeric representation of time should always be of POSIX timestamp type (number of seconds elapsed since 1970-01-01 00:00:00 UTC). Hence such time series plots would not have a particular treatment other than the particular overloaded ticks formatting function.

S.

Hello Stephane, hello Adeline
From Scilab 3DS team in Scilab 2024.0.0 release, there was unexpected very positive answer, to my lack of responsiveness (sorry) to describe the expected behaviour of such date and time data !
Indeed the new features around timeseries and underlaying datetime are moving fast in the right direction from my perspective , thank you all ! I didn’t take time yet to implement these new features in replacement of previous workarounds that I was using in my previous works, macros etc… but I evaluate, from help pages of these new features, that most of them are now well covered.

The main limitation i’m noticing is related to plot of datetime objects (underlaying representation is still datenum I guess, as a number of days since 1-Jan-0000 ?) ,topic of this post . It is directly linked with stackedplot which is not (yet) providing flexibility in data “investigation” or “first visualization” phase, when digging into data and trying to figure out what is happening in details, you need to zoom frequently, measure some time intervals between singular points,… Then I feel some improvements could be brought specifically to date&time objects visualization, about the following aspects:

  • multiple , successive zoom in and out on graphic figure time- x- axis => how to have relevant x-axis auto-ticks to suit to the current level of zoom?
  • datatips : optional adapted format for X: labels to ease readability in case of sate and time objects?

These comments are illustrated on the figure below, obtained from stackedplot last example in help page:

Thank you for the discussion and the developments already performed

David

Hello David,
I thank you for your message.
Indeed, the datetime function is a custom datenum. So when you use stackedplot, the X axis is actually datenum data where we modify the display with the xticks property of the axes. By forcing the display, the auto_ticks property is therefore “off” and when zooming, the ticks are not updated.
Regarding datatips, this is a good feedback ! To be investigated to find out if it is feasible.
I hope I answered your questions.
I wish you a joyful holiday season.
Adeline