#449 histograms are shifted when gap size is an even number

open-postponed
nobody
None
2
2009-12-31
2009-09-20
Thomas Sefzick
No

histograms are shifted to the right when gap size is an even number, everything's ok for odd gaps.
i first thought of an integer division, which is really there in 'graphics.c':
dxl += histogram_opts.gap/2;
dxr += histogram_opts.gap/2;
BUT with '2.0' instead of '2' as divisor ALL histograms are shifted to the right by half a box width, so in addition i subtract half a box size and now all histograms look ok.
i attach the patch plus a script with datafile to show the error.

nearly the same code is also in 'plot_bars()' in 'graphics.c' but i could figure out when it is used... so i didn't correct this part.

Discussion

  • Thomas Sefzick
    Thomas Sefzick
    2009-09-20

    graphics.c patch

     
    Attachments
  • Thomas Sefzick
    Thomas Sefzick
    2009-09-20

    script to show the error

     
    Attachments
  • Thomas Sefzick
    Thomas Sefzick
    2009-09-20

    datafile

     
    Attachments
  • Thomas Sefzick
    Thomas Sefzick
    2009-10-24

    thinking about it long enough, maybe it's better to leave it as it is...
    doing the tics placement right, inward tics are always abscured by filled histogram bars.
    with the existing code for an even gap size the tics are at bar boudaries which we would never get with the corrected code.
    so, i think it's better to call it a feature and document it:
    gap size is even: histograms are shifted so the tics are on histogram box boundaries
    gap size odd: histograms are not shifted, tics are in the middle of the histogram boxes belonging together, and in some cases obscured

     
  • Ethan Merritt
    Ethan Merritt
    2009-12-31

    • priority: 5 --> 2
    • status: open --> open-postponed