Opened 13 years ago
Closed 12 years ago
#489 closed task (fixed)
tick spacing with time
Reported by: | Peter Johansson | Owned by: | Peter Johansson |
---|---|---|---|
Priority: | major | Milestone: | svndigest 0.10 |
Component: | output | Version: | 0.9.1 |
Keywords: | Cc: |
Description (last modified by )
How are the ticks decided on the x-axis when using time-scale (default)? In yat there 15 months between the ticks, in base it is 11 months, and in svndigest it is 12 months for most but only 11 months between the two last ticks. I guess this is due to rounding error and the real number is 11 something.
IF I understand the code the ticks are based in seconds, but I would prefer that the ticks spacing is calculated in the relevant unit. For example when the x-axis spans a couple of years it makes sense to set the spacing to 12 months. When the project grows older, it could bump to 24 months and so on.
Change History (7)
comment:1 Changed 13 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 13 years ago by
Milestone: | svndigest 0.x+ → svndigest 0.10 |
---|
comment:3 Changed 13 years ago by
Status: | new → assigned |
---|
comment:4 follow-up: 5 Changed 13 years ago by
When playing around with this ticket I tried xticksspacing = 60*60*24*366 and that resulted in the ticks to appear exactly on new year, i.e., 00:00 Jan 1. AFAICS, this implies that plplot consider one year to be exactly 60*60*24*366 seconds or 366 days. Now our year is not 366 days but on average 365.25 so it probably implies that the ticks are shifting away on average 0.75 days per year. Since time zero occurred 41 years ago, the shift today would be roughly 30 days or a whole month. I consider this a bug in plplot and preferably I think we should set the xticks ourselves together with the text of the ticks. I need to do some research to see if that is possible.
comment:5 Changed 13 years ago by
Replying to peter:
When playing around with this ticket I tried xticksspacing = 60*60*24*366 and that resulted in the ticks to appear exactly on new year, i.e., 00:00 Jan 1. AFAICS, this implies that plplot consider one year to be exactly 60*60*24*366 seconds or 366 days. Now our year is not 366 days but on average 365.25 so it probably implies that the ticks are shifting away on average 0.75 days per year. Since time zero occurred 41 years ago, the shift today would be roughly 30 days or a whole month. I consider this a bug in plplot and preferably I think we should set the xticks ourselves together with the text of the ticks. I need to do some research to see if that is possible.
This in not correct. tickspacing=366days yields the ticks to appear at 00:00 but at Jan 1, Jan 2 etc, i.e., it jumps one day except when it's been a leap year. There is, however, another problem: plplot automatically floor the zeroth tick down to an even time point. Depending on the x-range this time point may be the start of the hour, start of the day etc. With an xrange greater than 3 years, the time point is the start of the year. They define the start of the year to {month=0; day=0; hour=0; min=0; sec=0}, which is problematic because {month=0; day=1} corresponds to January 1st in their date struct, so {month=0; day=0} is mod down to December 31st. Thus if we use tickspacing=365.25 we end up ticks on December 31st, which is not a problem per se, but the problem is that label says '10 Dec' when I would like '11 Jan'.
I consider this a bug in plplot, but even if they fix that bug is problematic to get ticks on January 1st. This is because even if we get the first tick on January 1st, have tickspacing=365.25days, and then have a leap year, the next tick might be on December 31t. Annoying.
comment:6 Changed 13 years ago by
(In [1327]) refs #489 and #490. Use default tickspacing provided by plplot. With current implementation, v6.9.6, it means range 6-15 -> spacing=2; range 15-30 -> spacing=5; range 30-60 -> spacing=10 and similarly for other order of magnitudes. For dates it is similar, but the unit changes dynamically depending on the range. Basically they choose the largest unit of seconds, minutes, hours, days, weeks, and years, such that range is at least 3 in that unit. So when the range is more than 3 years we're counting in years and when the range is between 3 weeks and 3 years we're counting in weeks.
comment:7 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I've reported plplot's unexpected behavior here, so I close this ticket
https://sourceforge.net/mailarchive/message.php?msg_id=27410406
I like having 5-10 ticks just like now. Also I think it makes sense that the ticks spacing is one months, 2 months, 3 months, 4 months, 6 months, 12 months or 24 months according to the following algorithm: