#274 Histogram type x-axis control modification

closed-out-of-date
Ethan Merritt
None
2
2008-09-03
2006-07-20
No

The histogram plot type that is in development for 4.1
seems to limit the amount of control that the user has
over the x-axis coordinates. (Note - I may be
overlooking a simple solution to this problem).
Although the xtic() and xticlabel() usage options allow
the user to specify the column from which the x-axis
values are to be taken, I didn't find an easy way to
plot the full dataset, but only label the x-axis at a
reasonable interval -- easy to do with other plot
formats using the set xaxis {} commands. Instead, all
points are plotted and labelled, which is fine for a
small number of points, but gets difficult to read for
a large number of bin values (for example, my dataset
has over 250 bins).

I made a couple of simple modifications to the plot2d.c
source to allow the user to specify the x-axis (bin
values) as an arbitrary column in the input dataset
(ie: 'foo.dat' using 2:1 ... would plot histogram
values from column 2 against bin values from column 1).
The automatic and manual selection of x-start, x-end
and x-inc are retained in this case.

The modifications seem to work for standard and stacked
histograms, without breaking any of the other types of
plots that I've tried. If I've overlooked the simple
solution, let me know -- otherwise, it's nice to have
this (std) level of control over the plotting of the
bin values in the histogram.
ron

Discussion

  • histogram x-axis patch (from {top_srcdir} patch with patch -p 0 <hist_xaxis.patch)

     
    Attachments
  • Ethan Merritt
    Ethan Merritt
    2006-07-20

    • priority: 5 --> 2
    • assigned_to: nobody --> sfeam
     
  • Ethan Merritt
    Ethan Merritt
    2006-07-20

    Logged In: YES
    user_id=235620

    xtic labels

    You have a couple of options here.
    For one, you can put the xitc(1) command in a separate clause:
    set style data histograms
    plot 'bigfile' using xtic(1):2 every 100 notitle, \ '' using 2, '' using 3, '' using 4

    For another, my experience is that if the histogram has so
    many entries that there is no room for individual labeling,
    then it works as well or better plotted 'with labels'. This
    is particularly true for stacked histogram plots. You can
    use linewidth to control the width of the vertical bars.

    Explicit x-coordinate

    The original histograms code did allow this, but it turned
    up a number of problems and I later took it out again. The
    primary issues are more policy and documentation than actual
    code. How is a command like the following supposed to be
    interpreted?
    set style data histograms
    plot 'foo' using 1:2, 'baz' using 3:4, '' using 5:6
    What if the x-coordinate entries in the three clauses do not
    match, or are not even on the same scale? What if an entry
    is missing in two of them, but missing in the third?
    Probably one can come up with some rationale set of rules,
    but what happened in practice was that users didn't get the
    results they expected, and their was no documented intended
    behavior because in fact there _was_ no well-thought-out
    intent in such cases.

    If the parallel clauses in the plot statement do not have
    identical and uniformly spaced X values, then again you are
    probably better off using 'with impulses' for such a plot.

    Post - 4.2

    Having said all that, I'm not adverse to the idea of
    explicit X coordinates so long as the rules are well-defined
    and properly documented. I'll have a look at your patch
    once version 4.2 goes out the door.

     
  • Ethan Merritt
    Ethan Merritt
    2006-07-20

    Logged In: YES
    user_id=235620

    Bother. What I *meant* to say was

    If the histogram has so many entries that there is no room
    for individual labeling, then it works as well or better
    plotted 'with impulses'.

    (not 'with labels'). Stupid typing fingers.

     
  • Logged In: YES
    user_id=823886

    I like the idea of using impulses ... just that this time
    I'm also making use of the new histogram stacking feature.
    I'll work with the xtic "every" label - that sounds like a
    good plan. Thanks :)

     
  • Ethan Merritt
    Ethan Merritt
    2006-07-20

    Logged In: YES
    user_id=235620

    "I like the idea of using impulses ... just that this time
    I'm also making use of the new histogram stacking feature."

    You can do stacking with impulses too, although the command
    is a bit awkward because you have to give an explicit sum
    for the height:

    set style data impulses
    plot 'foo' using 1:($2+$3+$4) ti col 4 lw 4, \ '' using 1:($2+$3) ti col 3 lw 4, \ '' using 1:($2) ti col 2 lw 4

     
  • Ethan Merritt
    Ethan Merritt
    2008-09-03

    • status: open --> closed-out-of-date
     
  • Ethan Merritt
    Ethan Merritt
    2008-09-03

    Logged In: YES
    user_id=235620
    Originator: NO

    CVS version now has provision for placement of stacked histograms at explicit x positions.