plotting in different ranges, breaking of axes

plotting in different ranges, breaking of axes

Post by Guido Dona » Thu, 11 May 2006 21:34:54


Hi,

I do have two questions concerning GnuPlot:

1.) How is it possible to plot two functions (or data files) in different
ranges. E.g. I have a datafile that ranges from 0 to 10 and I want to also
show the fit function I just calculated but just from 0 to 5. I have found
plot[xmin:xmag] something. But that restricts all shown data and functions
to that range ...

2.) Is there a possibility to break the axis. I have to shift some data in
order to see it more clearly. Thus I would like to break the yaxis at
certain points and let it start again from 0.

Thanks for any tips,

Guido
--
Why is 6 afraid of 7? Because 7, 8, 9!
 
 
 

plotting in different ranges, breaking of axes

Post by Hans-Bernh » Thu, 11 May 2006 22:35:43


<nitpick>No, you don't. You have questions about gnuplot. That's the
name of the program.</nitpick>


Various ways:

a) limit the function by making it undefined where you don't want it to
plot:

plot 'data', ((x<5)?f(x):0/0)

b) use parametric mode to get independent control over x and y of a
function:

set parametric
set trange [0:5]
plot 'data', t, f(t)


Only manually. And you lose automatic tick placement by doing it.


--
Hans-Bernhard Broeker ( XXXX@XXXXX.COM )
Even if all the snow were burnt, ashes would remain.

 
 
 

plotting in different ranges, breaking of axes

Post by Guido Dona » Fri, 12 May 2006 00:48:02

Am 10 May 2006 13:35:43 GMT schrieb Hans-Bernhard Broeker:


I am sorry about that ;-)


I don't get it. If i say

f(x)=x^2
plot sin(x), ((x<5)?f(x):0/0)

gnuplot says: non-integer passed to boolean operator


Well, I have 5 or 6 fit-functions that describe the data in certain
regions. I don't see how to do that with one parameter.


What do you mean by manual? I could live with manual tic placement...

Guido

--
Why is 6 afraid of 7? Because 7, 8, 9!
 
 
 

plotting in different ranges, breaking of axes

Post by Hans-Bernh » Fri, 12 May 2006 01:28:09


Unrelated. Read "help expression", and you'll understand why

plot f(x)

all by itself already fails.


By remapping it. set trange [0:1] and create a "t_to_x()" translation
function for each range.




*) Remove that edge of the box: --> 'help set border'
*) set up a function that maps from data values to a synthetic y
*) use it in a "using" specifier to fudge the data
*) set ytics ('0' map_y(0), '2' map_y(2), ... , '100' map_y(100))


--
Hans-Bernhard Broeker ( XXXX@XXXXX.COM )
Even if all the snow were burnt, ashes would remain.