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


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

Plotting a range accorrding to given numbers

Started byGudrun <bestenborstel@gmail.com>
First post2012-01-31 17:31 +0000
Last post2012-02-09 05:43 +0100
Articles 6 — 3 participants

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


Contents

  Plotting a range accorrding to given numbers Gudrun <bestenborstel@gmail.com> - 2012-01-31 17:31 +0000
    Re: Plotting a range accorrding to given numbers Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-01-31 22:31 +0100
      Re: Plotting a range accorrding to given numbers Gudrun <bestenborstel@gmail.com> - 2012-02-03 15:59 +0000
        Re: Plotting a range accorrding to given numbers Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-02-04 18:43 +0100
          Re: Plotting a range accorrding to given numbers Gudrun <bestenborstel@gmail.com> - 2012-02-06 12:07 +0000
          Re: Plotting a range accorrding to given numbers Hermann Peifer <peifer@gmx.eu> - 2012-02-09 05:43 +0100

#881 — Plotting a range accorrding to given numbers

FromGudrun <bestenborstel@gmail.com>
Date2012-01-31 17:31 +0000
SubjectPlotting a range accorrding to given numbers
Message-ID<jg98if$kbi$1@news.albasani.net>
Dear all

Let's assume you have data given in such a form
  	x	y	yerr
1	2	12	1
2	10	10	1
3	20	13	2
4	30	14	1

The first column is basically the counter/index for all other columns.
Can I tell gnuplot somehow to plot x(1:3), meaning plotting points 1 to 
3 for columns x and also for y and yerr? I don't want to take care about 
the values, I would like to assign this by index.

Reason: Sometimes it is a bit hard to plot 2<x<20 if the numbers are 
very close together and have a lot of decimal places behind the point.

Thank you for your help.

Kind regards
Gudrun

[toc] | [next] | [standalone]


#884

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2012-01-31 22:31 +0100
Message-ID<9or4tsFmgjU2@mid.dfncis.de>
In reply to#881
On 31.01.2012 18:31, Gudrun wrote:
> Dear all
>
> Let's assume you have data given in such a form
> x y yerr
> 1 2 12 1
> 2 10 10 1
> 3 20 13 2
> 4 30 14 1
>
> The first column is basically the counter/index for all other columns.
> Can I tell gnuplot somehow to plot x(1:3), meaning plotting points 1 to
> 3 for columns x and also for y and yerr? I don't want to take care about
> the values, I would like to assign this by index.

You're not being terribly clear, but it seems like you might be 
searching for 'help every', particularly

	plot 'file' every ::0::2

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


#903

FromGudrun <bestenborstel@gmail.com>
Date2012-02-03 15:59 +0000
Message-ID<jgh08u$7m4$1@news.albasani.net>
In reply to#884
Dear Hans-Bernhard,
sorry for my mis-explanation. x is the second column in the example 
below, y the third. The first column is the index.
I just want to plot x-column, y-column, and error-column with the help 
of the index-column.
Let's say index_1=2 (second line) and index_2=4 (last line).
Is there a command to plot x(index_1..index2) vs. y(index_1..index_2), 
meaning that the following is only plotted:

x y
2 10
3 20
4 30

Is this now by any chance better explained?
Sorry.
Thank you for your help.
G.





Am 31.01.12 21:31, schrieb Hans-Bernhard Bröker:
> On 31.01.2012 18:31, Gudrun wrote:
>> Dear all
>>
>> Let's assume you have data given in such a form
>> x y yerr
>> 1 2 12 1
>> 2 10 10 1
>> 3 20 13 2
>> 4 30 14 1
>>
>> The first column is basically the counter/index for all other columns.
>> Can I tell gnuplot somehow to plot x(1:3), meaning plotting points 1 to
>> 3 for columns x and also for y and yerr? I don't want to take care about
>> the values, I would like to assign this by index.
>
> You're not being terribly clear, but it seems like you might be
> searching for 'help every', particularly
>
> plot 'file' every ::0::2
>

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


#905

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2012-02-04 18:43 +0100
Message-ID<9p591rFh1tU1@mid.dfncis.de>
In reply to#903
On 03.02.2012 16:59, Gudrun wrote:

> I just want to plot x-column, y-column, and error-column with the help
> of the index-column.

The nature of that "help" is still a bit unclear, because the index 
column in your example file is deceptively simple.  As-is, it's actually 
superfluous, because it's just the line number.  So the 'every' option I 
mentioned before could actually do what you want in this particular case.

The question remains what is supposed to happen if the index column 
were, say

0
5
1
3
2
4

or

5
4
3
2
1
0

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


#907

FromGudrun <bestenborstel@gmail.com>
Date2012-02-06 12:07 +0000
Message-ID<jgofp7$e5l$1@news.albasani.net>
In reply to#905
Good morning, Hans-Bernhard.
I am confused with "every" and "index". I thought index is the command I 
am looking for.
In the end I am looking for a way to choose by line number if you wish 
to say so.
Every seems to work fine, although Gnuplot makes funny things if the 
entry is NaN.

Kind regards
Gudrun



Am 04.02.12 17:43, schrieb Hans-Bernhard Bröker:
> On 03.02.2012 16:59, Gudrun wrote:
>
>> I just want to plot x-column, y-column, and error-column with the help
>> of the index-column.
>
> The nature of that "help" is still a bit unclear, because the index
> column in your example file is deceptively simple. As-is, it's actually
> superfluous, because it's just the line number. So the 'every' option I
> mentioned before could actually do what you want in this particular case.
>
> The question remains what is supposed to happen if the index column
> were, say
>
> 0
> 5
> 1
> 3
> 2
> 4
>
> or
>
> 5
> 4
> 3
> 2
> 1
> 0
>

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


#925

FromHermann Peifer <peifer@gmx.eu>
Date2012-02-09 05:43 +0100
Message-ID<jgvitc$mhs$1@news.albasani.net>
In reply to#905
On 04/02/2012 18:43, Hans-Bernhard Bröker wrote:
> On 03.02.2012 16:59, Gudrun wrote:
>
>> I just want to plot x-column, y-column, and error-column with the help
>> of the index-column.
>
> The nature of that "help" is still a bit unclear, because the index
> column in your example file is deceptively simple. As-is, it's actually
> superfluous, because it's just the line number. So the 'every' option I
> mentioned before could actually do what you want in this particular case.
>
> The question remains what is supposed to happen if the index column
> were, say
>
> 0
> 5
> 1
> 3
> 2
> 4
>
> or
>
> 5
> 4
> 3
> 2
> 1
> 0
>

I would suggest something like:

plot "<( awk '$1 > 0 && $1 <= 3' my.dat)" ...

The above would ignore the order of the values in the first column and 
also plot in case of multiple occurrences of 1, 2 or 3. There are other 
AWK-Oneliners for only plotting the first occurrence of something, the 
last one, a random one, etc.

Occasionally, people in this group recommend to do data pre-processing 
with AWK and similar tools and use gnuplot for plotting only. I can only 
agree.

Hermann

[toc] | [prev] | [standalone]


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


csiph-web