Menu

#132 Improve tick interval calculations

6.0.0
closed
lbayuk
None
5
Fixed
2013-04-03
2009-12-22
lbayuk
No

This report documents a known problem with PHPlot, which for some reason has not yet really been written up as a bug report.

Tick intervals are naively calculated as (range/10) if not specified by the programmer with Set[XY]TickIncrement or SetNum[XY]Ticks. This results in some strange tick intervals.

Ticks should be calculated as more 'natural' numbers, such as a power of 10, times 1, 2, or 5. A different method is needed for date/time scales. Perhaps there needs to be programmer-control over which method to use, depending on the data.

Related

Bugs: #101
Wiki: 6.0.0-NEWS

Discussion

  • lbayuk

    lbayuk - 2012-04-25

    This effort has been restarted. There is a new method to calculate tick intervals, with one algorithm for date/time range, and one for other cases. The default case will pick a tick interval = N * 10 ** K, where N is 1, 2, or 5 and K is an integer. The date-time case will pick a tick interval based on a list of "good" values, for example 1, 2, 5, 10, 15, 30 seconds; 1, 2, 5, 10, 15, 30 minutes; etc.

    This only occurs if neither the tick interval nor number of ticks is set with SetXTickIncrement() or SetNumXTicks() (and similar for Y). Either of those completely overrides the automatic calculation.

    There will be the ability to "tune" the automatic algorithm, including: disallow a fractional tick interval (< 1), set the minimum number of tick intervals (with the maximum equal to about 2.5 times the minimum), and force use of the date/time algorithm. (By default, PHPlot will calculate a date/time tick interval if the label formatting for that axis is set to date/time values.)

    This work is tied in with bug #1795969 "Fix automatic Y range calculations" and the target is to have both fixed in PHPlot-6.0.

     
  • lbayuk

    lbayuk - 2012-06-07

    This is progressing well. Developement in SVN is at /branches/Rel6.

    The development branch passes all 800 tests in the test suite, with 412 producing different images. (Which is better than the 498 before recent changes.) Nearly all of the differing images are improved with this release.

    There are still issues with tick anchors, and with date/time ranges.

     
  • lbayuk

    lbayuk - 2012-09-08
    • milestone: --> 6.0.0
     
  • lbayuk

    lbayuk - 2013-03-27
    • resolution: None --> Fixed
     
  • lbayuk

    lbayuk - 2013-03-27

    This will be fixed in PHPlot-6.0.0. There are 3 new algorithms to pick a tick increment, and new functions to 'tune' the process. The 'decimal' method is the default, and is described above. It picks the largest tick increment T=K*10^N such that N is an integer (positive, negative, or zero), K is 1, 2, or 5, and the resulting number of tick intervals is no less than the minimum.

    The 'date' method will pick from a list of date/time intervals such as 1, 2, 5, 10, 15, 30 seconds, etc. The largest value will be used that results in no fewer than the minimum number of tick intervals.

    The third method is 'binary' and it picks a power of 2 as a tick increment, otherwise it is similar to 'decimal'.

    In a last-minute change, the default minimum number of tick intervals was changed from 5 to 8. This means plots will by default get between 8 and 20 tick intervals (vs 10 intervals for PHPlot-5.8.0 and earlier).

    Documentation has been updated, including a new section that describes the process, and references for the new functions.

     
  • lbayuk

    lbayuk - 2013-04-03
    • status: open --> closed
     
  • lbayuk

    lbayuk - 2013-04-03

    Fixed in 6.0.0

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.