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


Groups > comp.graphics.apps.gnuplot > #2598 > unrolled thread

concatenating xticlabels and y-axis-formatting

Started byBart Vandewoestyne <bart.vandewoestyne@gmail.com>
First post2014-09-25 01:55 -0700
Last post2014-10-02 08:13 -0700
Articles 11 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  concatenating xticlabels and y-axis-formatting Bart Vandewoestyne <bart.vandewoestyne@gmail.com> - 2014-09-25 01:55 -0700
    Re: concatenating xticlabels and y-axis-formatting Bart Vandewoestyne <bart.vandewoestyne@gmail.com> - 2014-09-25 02:29 -0700
      Re: concatenating xticlabels and y-axis-formatting Ethan A Merritt <EAMerritt@gmail.com> - 2014-09-25 19:51 -0700
        Re: concatenating xticlabels and y-axis-formatting Bart Vandewoestyne <bart.vandewoestyne@gmail.com> - 2014-09-26 04:14 -0700
          Re: concatenating xticlabels and y-axis-formatting Ethan A Merritt <EAMerritt@gmail.com> - 2014-09-26 08:53 -0700
            Re: concatenating xticlabels and y-axis-formatting Bart Vandewoestyne <bart.vandewoestyne@gmail.com> - 2014-09-29 01:53 -0700
              Re: concatenating xticlabels and y-axis-formatting Ethan A Merritt <EAMerritt@gmail.com> - 2014-09-29 08:35 -0700
                Re: concatenating xticlabels and y-axis-formatting Bart Vandewoestyne <bart.vandewoestyne@gmail.com> - 2014-09-30 08:10 -0700
                  Re: concatenating xticlabels and y-axis-formatting Ethan A Merritt <sfeam@users.sourceforge.net> - 2014-09-30 16:43 -0700
                    Re: concatenating xticlabels and y-axis-formatting Bart Vandewoestyne <bart.vandewoestyne@gmail.com> - 2014-10-02 01:34 -0700
                      Re: concatenating xticlabels and y-axis-formatting Ethan A Merritt <EAMerritt@gmail.com> - 2014-10-02 08:13 -0700

#2598 — concatenating xticlabels and y-axis-formatting

FromBart Vandewoestyne <bart.vandewoestyne@gmail.com>
Date2014-09-25 01:55 -0700
Subjectconcatenating xticlabels and y-axis-formatting
Message-ID<b0938425-a89a-4d30-9276-3b57275d3011@googlegroups.com>
I have the following data file:

https://dl.dropboxusercontent.com/u/32340538/gnuplot/BigBenchTimes_short.csv

I'm plotting this data with the following script:

https://dl.dropboxusercontent.com/u/32340538/gnuplot/BigBenchTimes.pl

As you can see, currently the xticlabels are taken from the first column.  I would like the xticlabels to be the concatenation of columns 2, 3 and 4.  I tried

plot "BigBenchTimes_short.csv" using 7:(xticlabels(stringcolumn(2).stringcolumn(3).stringcolumn(4))) ti ""

but this gives me a segmentation fault:

bart@speedwing:~/Dropbox/Public/gnuplot$ gnuplot BigBenchTimes.pl 
Segmentation fault (core dumped)

Is there a way to do this?

My second question is how I can show the time on the y-axis in hours, minutes and seconds format instead of milliseconds.  Do I have to do the conversion myself manually, or can I somehow set a format for the Y-axes so that the milliseconds are automagically converted to HH:MM:SS.SSS format?

My gnuplot version is the one that comes with my Ubuntu Ubuntu 14.04.1 LTS, namely gnuplot 4.6 patchlevel 4.

Thanks,
Bart

[toc] | [next] | [standalone]


#2599

FromBart Vandewoestyne <bart.vandewoestyne@gmail.com>
Date2014-09-25 02:29 -0700
Message-ID<d1b314c9-615b-46a8-a612-58ad368e39f9@googlegroups.com>
In reply to#2598
On Thursday, September 25, 2014 10:55:46 AM UTC+2, Bart Vandewoestyne wrote:
>
> As you can see, currently the xticlabels are taken from the first column.  I would like the xticlabels to be the concatenation of columns 2, 3 and 4.  I tried
> 
> plot "BigBenchTimes_short.csv" using 7:(xticlabels(stringcolumn(2).stringcolumn(3).stringcolumn(4))) ti ""
> 
> but this gives me a segmentation fault:
> 
> bart@speedwing:~/Dropbox/Public/gnuplot$ gnuplot BigBenchTimes.pl 
> 
> Segmentation fault (core dumped)

I just noticed that the following *does* work:

plot "BigBenchTimes_short.csv" using 7:xticlabels(sprintf("%s, stream %s, query %s", stringcolumn(2), stringcolumn(3), stringcolumn(4))) ti ""

Exactly what I needed, so first problem solved :-)

For showing the milliseconds in HH:MM:SS.SSS I haven't figured out a solution yet.  I tried several things with

  set ydata time

or

  set format y "%H:%M:%S"

but didn't find something that works yet.  Any hints on this one are still welcome.

Regards,
Bart

[toc] | [prev] | [next] | [standalone]


#2600

FromEthan A Merritt <EAMerritt@gmail.com>
Date2014-09-25 19:51 -0700
Message-ID<m02kbf$agu$1@dont-email.me>
In reply to#2599
Bart Vandewoestyne wrote:

> On Thursday, September 25, 2014 10:55:46 AM UTC+2, Bart Vandewoestyne
> wrote:
>>
>> As you can see, currently the xticlabels are taken from the first
>> column.  I would like the xticlabels to be the concatenation of
>> columns 2, 3 and 4.  I tried
>> 
>> plot "BigBenchTimes_short.csv" using
>> 7:(xticlabels(stringcolumn(2).stringcolumn(3).stringcolumn(4))) ti ""
>> 
>> but this gives me a segmentation fault:
>> 
>> bart@speedwing:~/Dropbox/Public/gnuplot$ gnuplot BigBenchTimes.pl
>> 
>> Segmentation fault (core dumped)
> 
> I just noticed that the following *does* work:
> 
> plot "BigBenchTimes_short.csv" using 7:xticlabels(sprintf("%s, stream
> %s, query %s", stringcolumn(2), stringcolumn(3), stringcolumn(4))) ti
> ""
> 
> Exactly what I needed, so first problem solved :-)
> 
> For showing the milliseconds in HH:MM:SS.SSS I haven't figured out a
> solution yet.  I tried several things with
> 
>   set ydata time
> 
> or
> 
>   set format y "%H:%M:%S"
> 
> but didn't find something that works yet.  Any hints on this one are
> still welcome.

  yticlabels(8)

will echo back what's in the file.  Is that what you want?


> 
> Regards,
> Bart

[toc] | [prev] | [next] | [standalone]


#2601

FromBart Vandewoestyne <bart.vandewoestyne@gmail.com>
Date2014-09-26 04:14 -0700
Message-ID<53330d1f-097b-49ec-93da-dbf3d5414330@googlegroups.com>
In reply to#2600
On Friday, September 26, 2014 4:51:27 AM UTC+2, Ethan A Merritt wrote:
> 
>   yticlabels(8)
> 
> will echo back what's in the file.  Is that what you want?

I tried this solution with the script online at

https://dl.dropboxusercontent.com/u/32340538/gnuplot/BigBenchTimes.pl

Resulting plot is online at

https://dl.dropboxusercontent.com/u/32340538/gnuplot/screenshot1.png

This is not really what I want, for several reasons:

1) yticlabels are overlapping.  I would prefer to have evenly spaced yticlabels, but in HH:MM:SS.SSS format instead of milliseconds.  So for example ytics of the form HH:MM:SS.SSS every 15 minutes or every hour or so.

2) xticlabels are gone

Any other suggestion?

Kind regards,
Bart

[toc] | [prev] | [next] | [standalone]


#2602

FromEthan A Merritt <EAMerritt@gmail.com>
Date2014-09-26 08:53 -0700
Message-ID<m04251$hsa$1@dont-email.me>
In reply to#2601
Bart Vandewoestyne wrote:

> On Friday, September 26, 2014 4:51:27 AM UTC+2, Ethan A Merritt wrote:
>> 
>>   yticlabels(8)
>> 
>> will echo back what's in the file.  Is that what you want?
> 
> I tried this solution with the script online at
> 
> https://dl.dropboxusercontent.com/u/32340538/gnuplot/BigBenchTimes.pl
> 
> Resulting plot is online at
> 
> https://dl.dropboxusercontent.com/u/32340538/gnuplot/screenshot1.png
> 
> This is not really what I want, for several reasons:
> 
> 1) yticlabels are overlapping.  I would prefer to have evenly spaced
> yticlabels, but in HH:MM:SS.SSS format instead of milliseconds.  So
> for example ytics of the form HH:MM:SS.SSS every 15 minutes or every
> hour or so.

Millisecond precision over an axis range with hourly spacing would
imply 7 or more decimal places of accuracy in the display.
That exceeds the precision of any output device I know of.

Of course if you want to stick ".000" on the end of each tic label,
you can.  Just put it in the format statement.  But it won't convey
any useful information.

However it could make sense to attach millisecond precision to individual
data points if they are sparsely distributed.
That is why yticlabels might be an option.  

> 2) xticlabels are gone

You must have done something wrong.
The x and y tic labels are independent, and can both use
data-driver labels if requested:

 plot "BigBenchTimes_short.csv" using 7:xticlabels(stringcolumn(2).stringcolumn(3).stringcolumn(4)):yticlabels(8)

[toc] | [prev] | [next] | [standalone]


#2607

FromBart Vandewoestyne <bart.vandewoestyne@gmail.com>
Date2014-09-29 01:53 -0700
Message-ID<9c639906-7338-481c-a991-74a92164dcf3@googlegroups.com>
In reply to#2602
On Friday, September 26, 2014 5:53:06 PM UTC+2, Ethan A Merritt wrote:
> 
> Millisecond precision over an axis range with hourly spacing would
> imply 7 or more decimal places of accuracy in the display.
> That exceeds the precision of any output device I know of.

I agree on this one :-)  Milliseconds precision makes no sense here.

> [...]
> However it could make sense to attach millisecond precision to individual
> data points if they are sparsely distributed.
> That is why yticlabels might be an option.

The data points are not that sparsely distributed.  Using yticlabels, this is what I get:

https://dl.dropboxusercontent.com/u/32340538/gnuplot/yticlabels_not_nice.png

As you can see, quite a cluttered graph.  Not really what I want.  It would be better to have equally spaced Y ticlabels that have a format that is one of

HH:MM:SS
HH:MM
HH
MM:SS
MM
SS

Which of these formats gets selected, should depend on the data-values (some data is only minutes, other is hours).

Is there a way to create these evenly spaced time-ticlabels and let gnuplot decide for itself the exact formatting of the y ticlabels?

[toc] | [prev] | [next] | [standalone]


#2608

FromEthan A Merritt <EAMerritt@gmail.com>
Date2014-09-29 08:35 -0700
Message-ID<m0bu8g$qpe$1@dont-email.me>
In reply to#2607
Bart Vandewoestyne wrote:

> On Friday, September 26, 2014 5:53:06 PM UTC+2, Ethan A Merritt wrote:
>> 
>> Millisecond precision over an axis range with hourly spacing would
>> imply 7 or more decimal places of accuracy in the display.
>> That exceeds the precision of any output device I know of.
> 
> I agree on this one :-)  Milliseconds precision makes no sense here.
> 
>> [...]
>> However it could make sense to attach millisecond precision to
>> individual data points if they are sparsely distributed.
>> That is why yticlabels might be an option.
> 
> The data points are not that sparsely distributed.  Using yticlabels,
> this is what I get:
> 
> https://dl.dropboxusercontent.com/u/32340538/gnuplot/yticlabels_not_nice.png
> 
> As you can see, quite a cluttered graph.  Not really what I want.  It
> would be better to have equally spaced Y ticlabels that have a format
> that is one of
> 
> HH:MM:SS
> HH:MM
> HH
> MM:SS
> MM
> SS
> 
> Which of these formats gets selected, should depend on the data-values
> (some data is only minutes, other is hours).
> 
> Is there a way to create these evenly spaced time-ticlabels and let
> gnuplot decide for itself the exact formatting of the y ticlabels?

I don't understand the "evenly spaced" part of that.  Either they are
evenly spaced, in which normal tic labeling should work, or they are
spaced according to the data, which is what yticlabels handles but you
say you don't want.

Maybe some variant of the last two plots here?

  http://gnuplot.sourceforge.net/demo_cvs/datastrings.html

Write whatever complicated time-format function you want and use it
like this: "plot $FOO using 1:2 with boxes, $FOO using 1:2:(f($2)) with labels"

[toc] | [prev] | [next] | [standalone]


#2609

FromBart Vandewoestyne <bart.vandewoestyne@gmail.com>
Date2014-09-30 08:10 -0700
Message-ID<ab82d11d-2cf5-458f-9c83-3ce3b8a2b5d8@googlegroups.com>
In reply to#2608
On Monday, September 29, 2014 5:35:44 PM UTC+2, Ethan A Merritt wrote:
>
> I don't understand the "evenly spaced" part of that.  Either they are> 
> evenly spaced, in which normal tic labeling should work, or they are> 
> spaced according to the data, which is what yticlabels handles but you> 
> say you don't want.

Ethan,

Sorry for not being able to express what I want ;-)  Here's another attempt:

Consider the graph at https://dl.dropboxusercontent.com/u/32340538/gnuplot/equally_spaced_ylabels.png

It was generated using the following script and data:

https://dl.dropboxusercontent.com/u/32340538/gnuplot/BigBenchTimes.pl
https://dl.dropboxusercontent.com/u/32340538/gnuplot/BigBenchTimes_short.csv

In this graph, the Y-values represent timings.  Currently, the Y-labels are 'equally spaced', but are expressed in milliseconds.  I would like to make it easier to read/interpret for the user, and express the Y-labels in hours, minutes, seconds instead of milliseconds.

See what I mean?  Or not :-)

Regards,
Bart

[toc] | [prev] | [next] | [standalone]


#2610

FromEthan A Merritt <sfeam@users.sourceforge.net>
Date2014-09-30 16:43 -0700
Message-ID<m0ff6m$gce$1@dont-email.me>
In reply to#2609
Bart Vandewoestyne wrote:

> In this graph, the Y-values represent timings.  Currently, the Y-labels
> are 'equally spaced', but are expressed in milliseconds.  I would like to
> make it easier to read/interpret for the user, and express the Y-labels in
> hours, minutes, seconds instead of milliseconds.

OK, I think I understand what you want.
There are number of changes needed to your script.

The bad news is - it doesn't work.
The good news is - it almost works.

I'll talk you through it, because some of the pieces work even
if the whole thing taken together triggers a bug.

1) gnuplot does time in seconds, not milliseconds, so...

   plot datafile using ($7/1000.)

2) to read the value as time-in-seconds on y

   set ydata time
   set timefmt y "%S"       # (version 5 accepts "%s" also)

3) to label the y axis in time units

   set format y "%H:%M:%.3S"

4) the first line of the file contains labels rather than data
   so we skip it in plotting:

   plot datafile skip 1 using ($7/1000.)

However there is a limitation and a bug.

The bug is that for some reason it loses the xticlabels(...)
while labelling the y axis in time units.  I'll add that to
the bug tracker.

The limitation is that gnuplot really thinks this is a date,
not a time, so the hours will wrap at 24.  There's already
a bug tracker item requesting a separate time mode to handle
time intervals rather than dates.

I'm reasonably sure both of these issues can be fixed before
version 5 is released, but I'm afraid you're out of luck
until then.

	Ethan

[toc] | [prev] | [next] | [standalone]


#2611

FromBart Vandewoestyne <bart.vandewoestyne@gmail.com>
Date2014-10-02 01:34 -0700
Message-ID<4fe115cd-3128-4e1a-92f9-476158b65384@googlegroups.com>
In reply to#2610
On Wednesday, October 1, 2014 1:43:14 AM UTC+2, Ethan A Merritt wrote:
>
> OK, I think I understand what you want.

I'm glad I've finally made myself clear :-)

> [...]
> I'll talk you through it, because some of the pieces work even
> if the whole thing taken together triggers a bug.
> 
> 1) gnuplot does time in seconds, not milliseconds, so...
> 
>    plot datafile using ($7/1000.)
> 
> 2) to read the value as time-in-seconds on y
> 
>    set ydata time
>    set timefmt y "%S"       # (version 5 accepts "%s" also)

OK.  I understand what you are doing here.  I had played with 'set ydata time' and 'set timefmt' but I didn't think of the fact that I should plot using ($7/1000.)  Thanks for pointing me to that.

> 3) to label the y axis in time units
> 
>    set format y "%H:%M:%.3S"

I just discovered that I even like the following format more:

set format y "%Hh %Mm %.3Ss"

:-)

> 4) the first line of the file contains labels rather than data
>    so we skip it in plotting:
> 
>    plot datafile skip 1 using ($7/1000.)

Could it be that this 'skip 1' does not work with the version of gnuplot that I have, namely gnuplot 4.6 patchlevel 4 that comes with my Ubuntu Ubuntu 14.04.1 LTS?

> However there is a limitation and a bug.
> 
> The bug is that for some reason it loses the xticlabels(...)
> while labelling the y axis in time units.  I'll add that to
> the bug tracker.

Same behavior here.

> The limitation is that gnuplot really thinks this is a date,
> not a time, so the hours will wrap at 24.  There's already
> a bug tracker item requesting a separate time mode to handle
> time intervals rather than dates.

Exactly what I experienced and figured out while I was playing with the 'set ydata time' and 'set timefmt' commands.

> I'm reasonably sure both of these issues can be fixed before
> version 5 is released, but I'm afraid you're out of luck
> until then.

OK.  I'm glad to finally discover that what I want to do is apparently not so obvious in the current version of gnuplot.  Please know that i *did* read/study the documentation ;-)

So for now, I'll stick to the plot with milliseconds, or I try to live with the bug (xticlabels gone) and limitation (24 hour wrapping).

Thanks!
Bart

[toc] | [prev] | [next] | [standalone]


#2612

FromEthan A Merritt <EAMerritt@gmail.com>
Date2014-10-02 08:13 -0700
Message-ID<m0jq2m$tmi$1@dont-email.me>
In reply to#2611
Bart Vandewoestyne wrote:

>> 4) the first line of the file contains labels rather than data
>>so we skip it in plotting:
>>
>>plot datafile skip 1 using ($7/1000.)
> 
> Could it be that this 'skip 1' does not work with the version of
> gnuplot that I have, namely gnuplot 4.6 patchlevel 4 that comes with
> my Ubuntu Ubuntu 14.04.1 LTS?

Yes.  It was added to 4.6 very recently in order to be compatible
with the upcoming version 5 syntax.


>> However there is a limitation and a bug.
>>
>> The bug is that for some reason it loses the xticlabels(...)
>> while labelling the y axis in time units.  I'll add that to
>> the bug tracker.
> 
> Same behavior here.

It turns out that this bug is limited to plotting with histograms.
If you can live with changing your plot to use "with boxes" instead
then the xticlabels will reappear.

>> The limitation is that gnuplot really thinks this is a date,
>> not a time, so the hours will wrap at 24.  There's already
>> a bug tracker item requesting a separate time mode to handle
>> time intervals rather than dates.
> 
> Exactly what I experienced and figured out while I was playing with
> the 'set ydata time' and 'set timefmt' commands.

Karl Ratzsch has started a discussion on the developer mailing
list about whether version 5 should separate the effect of
'set ydata time' from the creation of axis labels.
Up till now this command has affected both input and output.
The idea is that perhaps the output side should change to be a
property of 'set ytics' instead, or perhaps modify the 
'set format y' command to flag that time formats should be used.
If you have thoughts on the subject, please speak up.

>> I'm reasonably sure both of these issues can be fixed before
>> version 5 is released, but I'm afraid you're out of luck
>> until then.
> 
> OK.  I'm glad to finally discover that what I want to do is apparently
> not so obvious in the current version of gnuplot.  Please know that i
> *did* read/study the documentation ;-)

The histogram+ticlabels bug is already fixed in CVS.
Introduction of new time formats that wouldn't necessarily wrap
values at day/month/year boundaries is tied up with whether the
input and output properties are separable.  This is further 
complicated by the problem that not all time or date quantities
are associated with an axis coordinate per se.  See for example
https://sourceforge.net/p/gnuplot/feature-requests/392/

	Ethan

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web