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


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

How can I use two different ranges for y axis?

Started by"Dr. David Kirkby" <drkirkby@gmail.com>
First post2013-09-26 05:45 -0700
Last post2013-10-09 16:28 -0700
Articles 4 — 3 participants

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


Contents

  How can I use two different ranges for y axis? "Dr. David Kirkby" <drkirkby@gmail.com> - 2013-09-26 05:45 -0700
    Re: How can I use two different ranges for y axis? Karl <mail.kfr@gmx.net> - 2013-09-26 16:47 +0200
      Re: How can I use two different ranges for y axis? Karl <ratzsch@polymer.uka.de> - 2013-09-28 12:59 +0200
        Re: How can I use two different ranges for y axis? "Dr. David Kirkby" <drkirkby@gmail.com> - 2013-10-09 16:28 -0700

#2051 — How can I use two different ranges for y axis?

From"Dr. David Kirkby" <drkirkby@gmail.com>
Date2013-09-26 05:45 -0700
SubjectHow can I use two different ranges for y axis?
Message-ID<f4eef6d6-94d2-42f4-806f-87e575d32b2b@googlegroups.com>
I have some data in a file:

http://www.vnacalibration.co.uk/Kits/SN0014/attenuator.s2p

The first column is the frequency in MHz. I want to plot the 4th column (magnitude) and 5th column (phase) column vs frequency. I can do this in two individual graphs, and get the following. 

http://www.vnacalibration.co.uk/Kits/SN0014/attenuator-magnitude.pdf
http://www.vnacalibration.co.uk/Kits/SN0014/attenuator-phase.pdf


I'd like to plot the two sets of data on one graph, but obviously need different scales for the two y-axes, as one remains close to -30 dB, whereas the other varies from -180 to +180 degrees. 

I tried the following: 

set xlabel "Frequency (MHz)"
set ylabel "Magnitude of S21 (dB)" 
set y2label "Phase of S21 (deg)" 
set yrange [-31:-29]
set y2range [-180:180]
plot "attenuator.s2p" using 1:4 with lines lt rgb "orange" title "magnitude", "attenuator.s2p" using 1:5 with lines lt rgb "blue" title "phase" 

but it seems both graphs are plotted over the range -31 to -29, which is ok for the magnitude data, but not for the phase, which needs to go over the range -180 to +180 degrees. 

I'm using gnuplot 4.6 patchlevel 1. 

Can anyone suggest how I can achieve what I want? 

Dave 

[toc] | [next] | [standalone]


#2052

FromKarl <mail.kfr@gmx.net>
Date2013-09-26 16:47 +0200
Message-ID<l21hef$9is$1@news.rz.uni-karlsruhe.de>
In reply to#2051
Am 26.09.2013 14:45, schrieb Dr. David Kirkby:
> 
> I'd like to plot the two sets of data on one graph, but obviously need different scales for the two y-axes, as one remains close to -30 dB, whereas the other varies from -180 to +180 degrees. 
> 
> I tried the following: 
> 
> set xlabel "Frequency (MHz)"
> set ylabel "Magnitude of S21 (dB)" 
> set y2label "Phase of S21 (deg)" 
> set yrange [-31:-29]
> set y2range [-180:180]
> plot "attenuator.s2p" using 1:4 with lines lt rgb "orange" title "magnitude", "attenuator.s2p" using 1:5 with lines lt rgb "blue" title "phase" 
> 

You missed giving the second plot the "axes x1y2" option.

 Karl

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


#2053

FromKarl <ratzsch@polymer.uka.de>
Date2013-09-28 12:59 +0200
Message-ID<l26cqu$8fb$1@news.rz.uni-karlsruhe.de>
In reply to#2052
On 26.09.2013 16:47, Karl wrote:
> Am 26.09.2013 14:45, schrieb Dr. David Kirkby:
>>
>> I'd like to plot the two sets of data on one graph, but obviously need different scales for the two y-axes, as one remains close to -30 dB, whereas the other varies from -180 to +180 degrees. 
>>
>> I tried the following: 
>>
>> set xlabel "Frequency (MHz)"
>> set ylabel "Magnitude of S21 (dB)" 
>> set y2label "Phase of S21 (deg)" 
>> set yrange [-31:-29]
>> set y2range [-180:180]
>> plot "attenuator.s2p" using 1:4 with lines lt rgb "orange" title "magnitude", "attenuator.s2p" using 1:5 with lines lt rgb "blue" title "phase" 
>>
> 
> You missed giving the second plot the "axes x1y2" option.
> 


and you have to

set y2tics
set ytics nomirr

so the second, right axis gets a scale

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


#2127

From"Dr. David Kirkby" <drkirkby@gmail.com>
Date2013-10-09 16:28 -0700
Message-ID<09102184-3164-4255-ae9a-c0e1e39d1f4d@googlegroups.com>
In reply to#2053
On Saturday, 28 September 2013 11:59:48 UTC+1, Karl  wrote:

> > You missed giving the second plot the "axes x1y2" option.
> 
> > 
> 
> and you have to
> 
> 
> set y2tics
> 
> set ytics nomirr
> so the second, right axis gets a scale


Thank you, that worked well. 

Dave 

[toc] | [prev] | [standalone]


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


csiph-web