On Friday, 20 December 2013 01:39:17 PM Risto Toivonen wrote:
> Hi,
>
> I came across a problem when using the histogram cluster style.
> Manual states that the location of the first cluster at the x-axis is
> x=1. However, if I use explicit title option then the first cluster is
> located at x=0. Is there way to get an equal behavior for the both of
> the situations (with and without the title)?
The documentation may be confusing.
Here is what is happening:
Your data file contains header information, not data values,
on the first line. That's fine, but the program doesn't magically know that.
It needs some hint from user that the first line is special.
> plot for[I=2:3] 'test.dat' using I:xticlabels(1) title columnheader(I)
Here "title columnheader()" clues in the program that the first line is
special. The first line is used to generate labels and the following line
(2nd line of file) is used a the first row of data y1[0] y2[0] ...
Because the index is 0, the first histogram cluster is at x=0
> plot for[I=2:3] 'test.dat' using I:xticlabels(1) notitle
Here there is no hint that the first line is special, so the program
tries to read it as data. But the contents of the first line aren't
readable as numbers so y1[0] y2[0] ... produce no histogram
bars. The first visible set of bars is y1[1] y2[1] which is drawn at x=1.
If you replaces labels "M1" and "M2" with "1" and "2" you'll see
what's happening.
The solution to your problem is to give the program a global
hint that the first line of the input contains labels, even though
the plot command may not use them:
set key autotitle columnheader
Ethan
>
> My test file (test.dat):
> -------------
> part M1 M2 p
> A 2.42 2.2 0.01
> B 2.50 2.1 0.03
> -------------
>
> Commands:
> -------------
> reset
> set style data histograms
> set style histogram cluster
> set style fill solid 1.0 border lt -1
> set key left top
> set xrange [-0.5:2.5]
> set yrange [0:3]
>
> plot for[I=2:3] 'test.dat' using I:xticlabels(1) notitle
> # Example here: http://picpaste.com/test-notitle-1u9GkFC8.png
>
> plot for[I=2:3] 'test.dat' using I:xticlabels(1) title columnheader(I)
> # Example here: http://picpaste.com/test-title-fAPyp44x.png
> -------------
>
> I'm using the following: G N U P L O T Version 4.6 patchlevel 3 last
> modified 2013-04-12 Build System: FreeBSD i386
>
>
> Any ideas?
>
> Thank you,
> Risto
>
>
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
|