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


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

Scaling a curve

Started byDieter Britz <dieterhansbritz@gmail.com>
First post2013-04-24 11:58 +0000
Last post2013-04-24 14:50 +0200
Articles 10 — 4 participants

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


Contents

  Scaling a curve Dieter Britz <dieterhansbritz@gmail.com> - 2013-04-24 11:58 +0000
    Re: Scaling a curve Christoph Bersch <usenet@bersch.net> - 2013-04-24 14:42 +0200
      Re: Scaling a curve Dieter Britz <dieterhansbritz@gmail.com> - 2013-04-24 12:46 +0000
        Re: Scaling a curve Dieter Britz <dieterhansbritz@gmail.com> - 2013-04-24 12:54 +0000
          Re: Scaling a curve Christoph Bersch <usenet@bersch.net> - 2013-04-24 15:13 +0200
            Re: Scaling a curve Karl <ratzsch@polymer.uka.de> - 2013-04-24 15:29 +0200
              Re: Scaling a curve Christoph Bersch <usenet@bersch.net> - 2013-04-24 15:34 +0200
              Re: Scaling a curve sfeam <sfeam@users.sourceforge.net> - 2013-04-24 08:00 -0700
            Re: Scaling a curve Dieter Britz <dieterhansbritz@gmail.com> - 2013-04-25 09:55 +0000
    Re: Scaling a curve Karl <ratzsch@polymer.uka.de> - 2013-04-24 14:50 +0200

#1782 — Scaling a curve

FromDieter Britz <dieterhansbritz@gmail.com>
Date2013-04-24 11:58 +0000
SubjectScaling a curve
Message-ID<kl8hd7$dev$1@dont-email.me>
My apologies if I have asked this before (but I don't think I have):
I want to scale a curve by diving the curve height by pi/2 = 0.6366.
I see that I can get a function of an axis by using "using", so why
doesn't this work:

 using 1:($2*0.6366)

?

In the manual, I find

 using 1:(log($2))

which led me to think this should work. Maybe even

 using 1:($2*2/pi)

-- 
Dieter Britz

[toc] | [next] | [standalone]


#1784

FromChristoph Bersch <usenet@bersch.net>
Date2013-04-24 14:42 +0200
Message-ID<kl8jp5$r20$1@dont-email.me>
In reply to#1782
Hi,

Am 24.04.2013 13:58, schrieb Dieter Britz:
> My apologies if I have asked this before (but I don't think I have):
> I want to scale a curve by diving the curve height by pi/2 = 0.6366.
> I see that I can get a function of an axis by using "using", so why
> doesn't this work:
>
>   using 1:($2*0.6366)

what does it mean "doesn't work"? How does your complete plot statement 
look like? Are you using functions, or data?

Christoph

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


#1785

FromDieter Britz <dieterhansbritz@gmail.com>
Date2013-04-24 12:46 +0000
Message-ID<kl8k83$kml$1@dont-email.me>
In reply to#1784
On Wed, 24 Apr 2013 14:42:07 +0200, Christoph Bersch wrote:

> Hi,
> 
> Am 24.04.2013 13:58, schrieb Dieter Britz:
>> My apologies if I have asked this before (but I don't think I have):
>> I want to scale a curve by diving the curve height by pi/2 = 0.6366.
>> I see that I can get a function of an axis by using "using", so why
>> doesn't this work:
>>
>>   using 1:($2*0.6366)
> 
> what does it mean "doesn't work"? How does your complete plot statement
> look like? Are you using functions, or data?
> 
> Christoph

Sorry! I just discovered a simple error in the script. The
error message ended with an arrow that I thought was pointing
at the rescaling bit, but it didn't.

-- 
Dieter Britz

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


#1787

FromDieter Britz <dieterhansbritz@gmail.com>
Date2013-04-24 12:54 +0000
Message-ID<kl8klo$ug5$1@dont-email.me>
In reply to#1785
On Wed, 24 Apr 2013 12:46:59 +0000, Dieter Britz wrote:

> On Wed, 24 Apr 2013 14:42:07 +0200, Christoph Bersch wrote:
> 
>> Hi,
>> 
>> Am 24.04.2013 13:58, schrieb Dieter Britz:
>>> My apologies if I have asked this before (but I don't think I have):
>>> I want to scale a curve by diving the curve height by pi/2 = 0.6366.
>>> I see that I can get a function of an axis by using "using", so why
>>> doesn't this work:
>>>
>>>   using 1:($2*0.6366)
>> 
>> what does it mean "doesn't work"? How does your complete plot statement
>> look like? Are you using functions, or data?
>> 
>> Christoph
> 
> Sorry! I just discovered a simple error in the script. The error message
> ended with an arrow that I thought was pointing at the rescaling bit,
> but it didn't.

However, when I fixed it, I still get an error and I can't see why.
The plot lines are

plot 'hhcurr.2.dat' using 1:($2*0.6366) w l lt 2,  'dhcurr2.dat' w l lt 
1, \
     'hhcurr.3.dat' using 1:($2*0.6366) w l lt 2,  'dhcurr3.dat' w l lt 
1, \
     'hhcurr.5.dat' using 1:($2*0.6366) w l lt 2,  'dhcurr5.dat' w l lt 
1, \
     'hhcurr.7.dat' using 1:($2*0.6366) w l lt 2,  'dhcurr7.dat' w l lt 
1, \
     'hhcurr.10.dat' using 1:($2*0.6366) w l lt 2,  'dhcurr10.dat' w l lt 
1

(Previously I had left out some quote marks). I get the message

gnuplot> plot 'hhcurr.2.dat' using 1:(*0.6366) w l lt 2,  'dhcurr2.dat' w 
l lt 1,      'hhcurr.3.dat' using 1:(*0.6366) w l lt 2,  'dhcurr3.dat' w 
l lt 1,      'hhcurr.5.dat' using 1:(*0.6366) w l lt 2,  'dhcurr5.dat' w 
l lt 1,      'hhcurr.7.dat' using 1:(*0.6366) w l lt 2,  'dhcurr7.dat' w 
l lt 1,      'hhcurr.10.dat' using 1:(*0.6366) w l lt 2,  'dhcurr10.dat' 
w l lt 1
                                      ^
         line 0: invalid expression 

but I don't see any error in that. ??
-- 
Dieter Britz

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


#1788

FromChristoph Bersch <usenet@bersch.net>
Date2013-04-24 15:13 +0200
Message-ID<kl8ljq$57f$1@dont-email.me>
In reply to#1787
Hi,

for testing, you should use less plot lines, then you would see

Am 24.04.2013 14:54, schrieb Dieter Britz:
>
> The plot lines are
>
> plot 'hhcurr.2.dat' using 1:($2*0.6366) w l lt 2
[...]
>
> (Previously I had left out some quote marks). I get the message
>
> gnuplot>  plot 'hhcurr.2.dat' using 1:(*0.6366) w l lt 2
>                                        ^
>           line 0: invalid expression

where the error exactly is.
How do you invoke the script? Is there any bash script, or similar 
involved? Then you would need to escape the dollar sign, e.g.

plot 'hhcurr.2.dat' using 1:(\$2*0.6366) w l lt 2

Christoph

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


#1790

FromKarl <ratzsch@polymer.uka.de>
Date2013-04-24 15:29 +0200
Message-ID<kl8toc$7db$1@news.rz.uni-karlsruhe.de>
In reply to#1788

On 24.04.2013 15:13, Christoph Bersch wrote:
> Am 24.04.2013 14:54, schrieb Dieter Britz:
>> gnuplot>  plot 'hhcurr.2.dat' using 1:(*0.6366) w l lt 2
>>                                        ^
>>           line 0: invalid expression

> How do you invoke the script? Is there any bash script, or similar
> involved? Then you would need to escape the dollar sign, e.g.

I´d say he loads the script from another gp-script using "call".
Then the dollar signs in the "using" statement need to be doubled.

plot '' using 1:($$2/pi*2)


  Karl

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


#1791

FromChristoph Bersch <usenet@bersch.net>
Date2013-04-24 15:34 +0200
Message-ID<kl8mrp$b3v$1@dont-email.me>
In reply to#1790
Am 24.04.2013 15:29, schrieb Karl:
>
> I´d say he loads the script from another gp-script using "call".
> Then the dollar signs in the "using" statement need to be doubled.

Ok, I never used that one. We'll see :-)

Christoph

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


#1792

Fromsfeam <sfeam@users.sourceforge.net>
Date2013-04-24 08:00 -0700
Message-ID<kl8rsq$6e9$1@dont-email.me>
In reply to#1790
Karl wrote:

> 
> 
> On 24.04.2013 15:13, Christoph Bersch wrote:
>> Am 24.04.2013 14:54, schrieb Dieter Britz:
>>> gnuplot>  plot 'hhcurr.2.dat' using 1:(*0.6366) w l lt 2
>>>                                        ^
>>>           line 0: invalid expression
> 
>> How do you invoke the script? Is there any bash script, or similar
>> involved? Then you would need to escape the dollar sign, e.g.
> 
> I´d say he loads the script from another gp-script using "call".
> Then the dollar signs in the "using" statement need to be doubled.
> 
> plot '' using 1:($$2/pi*2)

If there are multiple levels of scripting, interpretation of
reserved characters like $ can be problematic.  In this case
it would be safer to avoid the problem by saying

 plot '' using 1:(column(2)* 2.0/pi)

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


#1794

FromDieter Britz <dieterhansbritz@gmail.com>
Date2013-04-25 09:55 +0000
Message-ID<klauj5$rqi$1@dont-email.me>
In reply to#1788
On Wed, 24 Apr 2013 15:13:24 +0200, Christoph Bersch wrote:

> Hi,
> 
> for testing, you should use less plot lines, then you would see
> 
> Am 24.04.2013 14:54, schrieb Dieter Britz:
>>
>> The plot lines are
>>
>> plot 'hhcurr.2.dat' using 1:($2*0.6366) w l lt 2
> [...]
>>
>> (Previously I had left out some quote marks). I get the message
>>
>> gnuplot>  plot 'hhcurr.2.dat' using 1:(*0.6366) w l lt 2
>>                                        ^
>>           line 0: invalid expression
> 
> where the error exactly is.
> How do you invoke the script? Is there any bash script, or similar
> involved? Then you would need to escape the dollar sign, e.g.
> 
> plot 'hhcurr.2.dat' using 1:(\$2*0.6366) w l lt 2
> 
> Christoph

The backslash did the trick, thanks! Yes, this is part of a shell
script under .bashrc.

And I wrote incorrectly that I use 0.6366 for pi/2, but of course I
mean 2/pi. Now I suppose I ought to try using 1:(\$*2/pi). I might
do that.

Thanks for all your responses.
-- 
Dieter Britz

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


#1786

FromKarl <ratzsch@polymer.uka.de>
Date2013-04-24 14:50 +0200
Message-ID<kl8rfa$6hb$1@news.rz.uni-karlsruhe.de>
In reply to#1782

On 24.04.2013 13:58, Dieter Britz wrote:
> My apologies if I have asked this before (but I don't think I have):
> I want to scale a curve by diving the curve height by pi/2 = 0.6366.

?!?  0.637 is a bit more than pi/5!

> I see that I can get a function of an axis by using "using", so why
> doesn't this work:
> 
>  using 1:($2*0.6366)

Should definitely work. What do you get?

> 
> ?
> 
> In the manual, I find
> 
>  using 1:(log($2))
> 
> which led me to think this should work. Maybe even
> 
>  using 1:($2*2/pi)

Will work too, and give you the values you want.

  Karl

[toc] | [prev] | [standalone]


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


csiph-web