Custom scaling in gnuplot for y-axis (equivalent to logscale y-set)

I have defined a function f()

that I would like to use for scaling, similar to logscale (but f()

not a logarithmic function). Is there a way to do this automatically, for example set fscale y

?

Otherwise, I tried to plot the scaled function:

plot 'data' using 1:(f($2))

      

but then the scale on the y-axis is obviously wrong. Can I use my function to somehow change the scale of the y-axis?

I would like not to set all the labels and their labels manually (because I will be using this script for a lot of different graphs).

+3


source to share


1 answer


If your data is not much different, you can insert ticks semi-automatically by adding the plot command to set ytics ({"<label>"} <pos> {<level>} {,{"<label>"}...)

Just use the appropriate number of points to keep the graph clean.

Example:

$ cat ex.data 
0 0
1 3
2 2.2
5 5
7 1.2
9 4
12 9
15 5

      



so our y data ranges from 0 to 9.

 $ gnuplot

         G N U P L O T
         Version 4.4 patchlevel 3
         last modified March 2011
         System: Linux 3.2.0-24-generic

         Copyright (C) 1986-1993, 1998, 2004, 2007-2010
         Thomas Williams, Colin Kelley and many others

         gnuplot home:     http://www.gnuplot.info
         faq, bugs, etc:   type "help seeking-assistance"
         immediate help:   type "help"
         plot window:      hit 'h'

 Terminal type set to 'wxt'
 gnuplot> f(x) = x**2
 gnuplot> set yrange [0:f(10)]
 gnuplot> set ytics ("0" f(0), "5" f(5), "7.5" f(7.5), "10" f(10))
 gnuplot> plot "ex.data" u 1:(f($2)) w l

      

Result:

example plot

+5


source







All Articles