Simple Date & Time Plotting

classic Classic list List threaded Threaded
11 messages Options
Pat Pat
Reply | Threaded
Open this post in threaded view
|

Simple Date & Time Plotting

Hi All,

I would like to find a simple plotting function to enable a plot of numeric data against date/time  to be obtained.

I have read numerous workarounds to this problem from input over the years - usually involving manually manipulating X-Tick Text Data.
I'm just not sure how the graph would show X-axes labels if you zoomed on into the plot from, say, a 12-month time period right into a 24-hr time window within it.?
Would I have to run another script to help the plotter out?

In summary:
I would like to plot data Vs Date/Time such that it can automatically re-adjust the x-axis minor tick marks given the time span when zooming in - (X-axis in Date-Time format throughout).

Thanks in advance,

Patrick
Serge Steer-3 Serge Steer-3
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

I'm afraid it is yet not possible with the default zoom tool because for this behavior it should be necessary to have the possibility to attach a callback function that responds to the zoom the resize actions

But you can develop your own zoom menu for zooming time séries....
Serge Steer

Le 29/01/2013 18:30, Pat a écrit :
Hi All,

I would like to find a simple plotting function to enable a plot of numeric
data against *date/time * to be obtained.

I have read numerous workarounds to this problem from input over the years -
usually involving manually manipulating X-Tick Text Data.
I'm just not sure how the graph would show X-axes labels if you zoomed on
into the plot from, say, a 12-month time period right into a 24-hr time
window within it.?
Would I have to run another script to help the plotter out?

In summary:
I would like to plot data Vs Date/Time such that it can automatically
re-adjust the x-axis minor tick marks given the time span when zooming in -
(X-axis in Date-Time format throughout).

Thanks in advance,

Patrick



--
View this message in context: http://mailinglists.scilab.org/Simple-Date-Time-Plotting-tp4025833.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pat Pat
Reply | Threaded
Open this post in threaded view
|

RE: Simple Date & Time Plotting

Thanks for the prompt response Serge,

 

I’m afraid that type of function would be well beyond me!

Will be interested to see if anyone on the forum has tried to develop something similar in recent times.

 

Thanks again,

 

Patrick

 

 

From: Serge Steer [via Scilab / Xcos - Mailing Lists Archives] [mailto:[hidden email]]
Sent: 29 January 2013 18:59
To: Blee, Patrick
Subject: Re: Simple Date & Time Plotting

 

I'm afraid it is yet not possible with the default zoom tool because for this behavior it should be necessary to have the possibility to attach a callback function that responds to the zoom the resize actions


But you can develop your own zoom menu for zooming time séries....
Serge Steer

Le 29/01/2013 18:30, Pat a écrit :

Hi All,
 
I would like to find a simple plotting function to enable a plot of numeric
data against *date/time * to be obtained.
 
I have read numerous workarounds to this problem from input over the years -
usually involving manually manipulating X-Tick Text Data.
I'm just not sure how the graph would show X-axes labels if you zoomed on
into the plot from, say, a 12-month time period right into a 24-hr time
window within it.?
Would I have to run another script to help the plotter out?
 
In summary:
I would like to plot data Vs Date/Time such that it can automatically
re-adjust the x-axis minor tick marks given the time span when zooming in -
(X-axis in Date-Time format throughout).
 
Thanks in advance,
 
Patrick
 
 
 
--
View this message in context: http://mailinglists.scilab.org/Simple-Date-Time-Plotting-tp4025833.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
 



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


If you reply to this email, your message will be added to the discussion below:

http://mailinglists.scilab.org/Simple-Date-Time-Plotting-tp4025833p4025834.html

To unsubscribe from Simple Date & Time Plotting, click here.
NAML

David Chèze David Chèze
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

Hi Pat and all,

I was looking for similar simple feature for plotting time series with
readable date time format and I can share an intermediate approach to update
the x-ticks with a call to function labxdtv(), cf linked file  labxdtv.sci
<http://mailinglists.scilab.org/file/t375348/labxdtv.sci>  
There's no callback function, the function is called after the plot action
and after every changes in windows size or zoom level : initial plot is like
plot2(dtnm,Donnees), with dtnm a vector of datenum values and Donnees a
matrix of related data to plot. After the figure is plot at first time or
after every changes in windows size or level of zoom, call again labxdtv, it
regraduates automatically the x-axis according to the datanum span and
convert the datenum in readable date time vector format (auto_ticks are set
to on in the function).

Would be great to have in scilab a more powerful/flexible builtin
function... :)

David



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

Le 20/07/2018 à 12:20, David Chèze a écrit :
Hi Pat and all,

I was looking for similar simple feature for plotting time series with
readable date time format and I can share an intermediate approach to update
the x-ticks with a call to function labxdtv(), cf linked file  labxdtv.sci
<http://mailinglists.scilab.org/file/t375348/labxdtv.sci>  
There's no callback function, the function is called after the plot action
and after every changes in windows size or zoom level : initial plot is like
plot2(dtnm,Donnees), with dtnm a vector of datenum values and Donnees a
matrix of related data to plot. After the figure is plot at first time or
after every changes in windows size or level of zoom, call again labxdtv, it
regraduates automatically the x-axis according to the datanum span and
convert the datenum in readable date time vector format (auto_ticks are set
to on in the function).

Would be great to have in scilab a more powerful/flexible builtin
function... :) 

Sure, but it's a rather complex function. The need was reported 10 years ago @ http://bugzilla.scilab.org/6228
labxdtv() gives a rather raw idea of the task. On it's showcase example, ticks are every 3 months over one year:

But they are not nice:
  • At this scale, major ticks should rather be on the 1st of months.
  • there should not be any shift 17 => 18 => 19. This means that subticking must be completely customized, with a polyline superimposed to the axis, since it is irregular.
  • here there is only one subtick instead of rather two (for an automatic handling)
  • etc..

So yes, a powerful function formating dates would be nice. But implementing a really nice and useful one is definitely not trivial.

Cheers
Samuel

PS : there is presently no event triggered by zooming or panning an axes.


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

Le 20/07/2018 à 14:40, Samuel Gougeon a écrit :
Le 20/07/2018 à 12:20, David Chèze a écrit :
Hi Pat and all,

I was looking for similar simple feature for plotting time series with
readable date time format and I can share an intermediate approach to update
the x-ticks with a call to function labxdtv(), cf linked file  labxdtv.sci
<http://mailinglists.scilab.org/file/t375348/labxdtv.sci>  
There's no callback function, the function is called after the plot action
and after every changes in windows size or zoom level : initial plot is like
plot2(dtnm,Donnees), with dtnm a vector of datenum values and Donnees a
matrix of related data to plot. After the figure is plot at first time or
after every changes in windows size or level of zoom, call again labxdtv, it
regraduates automatically the x-axis according to the datanum span and
convert the datenum in readable date time vector format (auto_ticks are set
to on in the function).

Would be great to have in scilab a more powerful/flexible builtin
function... :) 

Sure, but it's a rather complex function. The need was reported 10 years ago @ http://bugzilla.scilab.org/6228
labxdtv() gives a rather raw idea of the task. On it's showcase example, ticks are every 3 months over one year:

But they are not nice:
  • At this scale, major ticks should rather be on the 1st of months.
  • there should not be any shift 17 => 18 => 19. This means that subticking must be completely customized, with a polyline superimposed to the axis, since it is irregular.
  • here there is only one subtick instead of rather two (for an automatic handling)

Even better, subticks could match weeks, for instance on each monday 00:00:00 (as the default, or as a subticking option).
This means that the first subtick after a major on the 1st at 00:00:00 will be shifted wrt its leading major, with a shift not equal from a major to the next.
Here, having 11-12 weekly subticks between 2 major ticks would be the right subticking scale.
If we use some subticks every 10 days instead of weekly ones, there will be also some irregularities for 28|29|31-days-long months for setting the last subtick.
All these details -- and others -- must be properly processed to really have a workable function.


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
David Chèze David Chèze
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

Hi samuel,

 

Thank you for your prompt comments, I fully agree that it’s not trivial to have a really nice function with the features you pointed out.

I would find hardly acceptable, from common excel coming users point of view, that Scilab can’t offer at least a raw feature to manage this very common task when processing data with timestamps over weeks, months, years therefore I proposed this raw approach.

An extra comments about the function labxdtv: labxdtv uses the automatic x-ticks locations caluclated from datenum values and convert into datevec-Like formats eg YY/MM/DD , MM/DD.hh, DD.hh:mm, hh:mm:ss according to the max span of the level of zoom in the current  display.

If the axis is zoomed or the window size changed, call again labxdtv so that it re-graduates this x-axis (according to datenum values) and convert the new x-ticks into appropriate datevec and automatic choice of the format YY/MM/DD , MM/DD.hh, DD.hh:mm, hh:mm:ss according to the max span of the x-axis.

 

In your first comment, I ‘m not sure to get your point about :

cid:image001.png@01D4203B.B4E40A30

  • there should not be any shift 17 => 18 => 19. This means that subticking must be completely customized, with a polyline superimposed to the axis, since it is irregular.

In the above example 17, 18 and 19 are years , not days so it’s rather normal display. At this level of zoom we have YY/MM/DD but if you manually zoom and change the window size and call again labxdtv() afterwards, you may obtain the following, which allow to see when you :

And zoom-in further around 2017 October, then labxdtv() called you may quickly obtain the figure below, so you can read directly that the format is automatically adapted to “MM/DD.HH”  It’s not so common format but acceptable to analyze the data on the fly.

I find quite important that the graduation on the figure is still relying on datenum, as it is the right underlying numerical format to show date time information.

 

Cheers,

 

David

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

Le 20/07/2018 à 15:27, CHEZE David 227480 a écrit :

Hi samuel,

 

Thank you for your prompt comments, I fully agree that it’s not trivial to have a really nice function with the features you pointed out.

I would find hardly acceptable, from common excel coming users point of view, that Scilab can’t offer at least a raw feature to manage this very common task when processing data with timestamps over weeks, months, years therefore I proposed this raw approach.


The problem with proposing an official function in a only raw version is that it becomes a commitment.
Then changing it is more difficult because backcompatibility issues must be avoided or/and handled.
This is why, to me, it is better to propose such a version on the fileexchange, that is more informal.


An extra comments about the function labxdtv: labxdtv uses the automatic x-ticks locations caluclated from datenum values and convert into datevec-Like formats eg YY/MM/DD , MM/DD.hh, DD.hh:mm, hh:mm:ss according to the max span of the level of zoom in the current  display.

If the axis is zoomed or the window size changed, call again labxdtv so that it re-graduates this x-axis (according to datenum values) and convert the new x-ticks into appropriate datevec and automatic choice of the format YY/MM/DD , MM/DD.hh, DD.hh:mm, hh:mm:ss according to the max span of the x-axis.


My PS meant that there is no equivalence of gcf().resizefcn for zooming. So, recalling labxdtv() must be done intentionnally, by hand, after zooming or spanning an axes.


 

In your first comment, I ‘m not sure to get your point about :

mailbox:///C:/Users/Samuel/AppData/Roaming/Thunderbird/Profiles/dm9cexq8.default/Mail/Local%20Folders/_Scilab.sbd/users@?number=97209056&header=quotebody&part=1.1.2&filename=image001.png

  • there should not be any shift 17 => 18 => 19. This means that subticking must be completely customized, with a polyline superimposed to the axis, since it is irregular.

In the above example 17, 18 and 19 are years , not days so it’s rather normal display.


My fault! As aa/bb/cc is in french the common format for dd/mm/yy, I paid attention only to the first aa/bb, taking them for days/months. Beside this misunderstanding, the discussion and remarks remain the same: then we could rather expect majors ticks always on 1st of some months, and smart subticks accordingly.


At this level of zoom we have YY/MM/DD but if you manually zoom and change the window size and call again labxdtv() afterwards, you may obtain the following, which allow to see when you :

And zoom-in further around 2017 October, then labxdtv() called you may quickly obtain the figure below, so you can read directly that the format is automatically adapted to “MM/DD.HH”  It’s not so common format but acceptable to analyze the data on the fly.


Usual commonly spread formats are quite known and shared.
AFAIK, the most standard one is YYYY-MM-DD HH:MN:SS.ssss, with possible truncation.

.../...

I find quite important that the graduation on the figure is still relying on datenum, as it is the right underlying numerical format to show date time information.

IMO, the input format should be customizable though an input option :
  • absolute formats : unix time, julian days, excel time, ... + linear (s, days, s..) vs vectorized (datenum, etc)
  • relative formats (without origin) : in s, mn, h, days

Best regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

Le 20/07/2018 à 18:33, Samuel Gougeon a écrit :

My PS meant that there is no equivalence of gcf().resizefcn for zooming. So, recalling labxdtv() must be done intentionnally, by hand, after zooming or spanning an axes.

Please read "zooming and panning"


.../...

I find quite important that the graduation on the figure is still relying on datenum, as it is the right underlying numerical format to show date time information.

IMO, the input format should be customizable though an input option :
  • absolute formats : unix time, julian days, excel time, ... + linear (s, days, s..) vs vectorized (datenum, etc)
  • relative formats (without origin) : in s, mn, h, days

May be speaking about absolute/relative scales, in a linearized or vectorized format would be clearer.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
David Chèze David Chèze
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

Hi Samuel,

 

Thank you for the comments and the discussion, I find it achieves some progress in the definition of the specifications of such a future feature. Do you assume it could be relevant to put it in the list of topics for SEP / GSOC / …  ?

 

Regards,

 

David

 

De : users <[hidden email]> De la part de Samuel Gougeon
Envoyé : vendredi 20 juillet 2018 18:40
À : Users mailing list for Scilab <[hidden email]>
Objet : Re: [Scilab-users] Simple Date & Time Plotting

 

Le 20/07/2018 à 18:33, Samuel Gougeon a écrit :


My PS meant that there is no equivalence of gcf().resizefcn for zooming. So, recalling labxdtv() must be done intentionnally, by hand, after zooming or spanning an axes.


Please read "zooming and panning"




.../...

I find quite important that the graduation on the figure is still relying on datenum, as it is the right underlying numerical format to show date time information.

IMO, the input format should be customizable though an input option :

  • absolute formats : unix time, julian days, excel time, ... + linear (s, days, s..) vs vectorized (datenum, etc)
  • relative formats (without origin) : in s, mn, h, days


May be speaking about absolute/relative scales, in a linearized or vectorized format would be clearer.


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Simple Date & Time Plotting

Hello David,

Le 23/07/2018 à 11:35, CHEZE David 227480 a écrit :

Hi Samuel,

 

Thank you for the comments and the discussion, I find it achieves some progress in the definition of the specifications of such a future feature. Do you assume it could be relevant to put it in the list of topics for SEP / GSOC / …  ?


Yes, indeed, IMO adding a strdate(), and maybe some ticksperiod(), functions to Scilab would be useful.
Designing them will require a SEP and further discussion.

Best regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users