Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2729

Re: Histogram like plot with time xdata time...

From Colin Brough <Colin.Brough@blueyonder.co.uk>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Histogram like plot with time xdata time...
References <UDpww.227584$4b6.175646@fx44.am4> <ma512k$pho$1@news.rz.uni-karlsruhe.de>
Message-ID <XFsxw.405239$Ud7.363320@fx11.am4> (permalink)
Organization virginmedia.com
Date 2015-01-26 15:02 +0000

Show all headers | View raw


On 26/01/15 09:23, Karl wrote:
> Am 23.01.2015 um 11:46 schrieb Colin Brough:
>> Folks
>>
>> I have three values for each month, in a data file formatted:
>>
>> YYYY:MM   D1  D2  D3
>>
>> I am attempting to plot these in a histogram like format, three
>> boxes/columns adjacent to each other for each month. Histograms don't
>> quite work (unless I'm missing something), as there may be months with
>> no data and I'd like the X-axis to read as time. Its easy enough to do
>> with linespoints (plot file included), but with xdata set to 'time', I
>> am struggling...
>>
>> With 'annual' data ("YYYY  DD1 DD2 DD3") its easy enough, since you
>> can:
>>      plot "data.dat" using ($1 - 0.25):($2 * 100) with boxes title "DD1",\
>>          "data.dat" using 1:($3 * 10) with boxes title "DD2",\
>>          "data.dat" using ($1 + 0.25):4 with boxes title "DD3"
>
>
> With time data, ($1-0.25) does not work, because 1 is not in years but
> "seconds since 1970" (or 2000, depending on your gp version).
>
> Something like ($1-0.25*30*24*3600) should do the trick by moving the
> bar a quarter of a month to the left.

That's what I thought too, but that doesn't seem to work as expected:

plot [][0:] "data.dat" using 1:($2 * 100) with boxes title "Workouts 
(x100)",\
	"data.dat" using ($1 - 648000):($3 * 10) with boxes title "Time (x10)",\
	"data.dat" using ($1 + 648000):4 with boxes title "Calories"

This produces a plot that looks like this:

     http://www.colinbrough.pwp.blueyonder.co.uk/2015_01_26_TimeBarChart.png

The blue and green columns at 01/2000 come from the the ($1 - 648000)
and ($1 + 648000) plots... (Time and Calories). The red (Workouts) is
what I'm expecting...

For the sake of completeness, I'm running gnuplot 4.6 patchlevel 4 on
Ubuntu 14.04.1 LTS.


Cheers

Colin

-- 

----------------------------------------------------------------------
Colin Brough                           Colin.Brough@blueyonder.invalid
                                 (Replace .invalid with .co.uk to reply)

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Histogram like plot with time xdata time... Colin Brough <Colin.Brough@blueyonder.co.uk> - 2015-01-23 10:46 +0000
  Re: Histogram like plot with time xdata time... Karl <mail.kfr@gmx.net> - 2015-01-26 10:23 +0100
    Re: Histogram like plot with time xdata time... Colin Brough <Colin.Brough@blueyonder.co.uk> - 2015-01-26 15:02 +0000
      Re: Histogram like plot with time xdata time... Karl <mail.kfr@gmx.net> - 2015-01-26 17:50 +0100
        Re: Histogram like plot with time xdata time... Colin Brough <Colin.Brough@blueyonder.co.uk> - 2015-01-26 17:41 +0000

csiph-web