#130 scale axis in splot

closed
nobody
None
5
2012-02-07
2011-10-10
Anonymous
No

Hello,
i am using
splot "data.txt" w l

with a data file like this:

0.6340000E+03
0.5057355E+03
0.3973058E+03
0.3087108E+03

0.2399504E+03
0.1910248E+03
0.1619339E+03
0.1526777E+03

0.1632562E+03
0.5369752E+03
0.4153223E+03
0.3135041E+03

In this plot, the xaxis is from 0-3 , the yaxis from 0-2
so far so good.
No i want to scale the x and y axis.
Is there any possibility to do so?

I played around with splot using and pseudocolumns 0, -1 and -2
but that does not work.

Discussion

  • > I played around with splot using and pseudocolumns 0, -1 and -2
    > but that does not work.

    So I guess you didn't find "help pseudocolumns" to find out how to write this:

    splot '-' using (column(-1)/5.0):(($0-4*column(-1))/3.0):1 w lp

     
  • The counter $0-4*column(-1) is o.k. but you need to know
    that the data file holds 4 values in each bloc.
    This can't be used in a general purpose script.

    I finally found
    # Physical Range of X and Y data
    xmin = 10.
    xmax = 20.
    ymin = 40.
    ymax = 60.

    splot "fo1.txt" w l
    ix = GPVAL_DATA_X_MAX # Workaround to find No. of grid data lines
    iy = GPVAL_DATA_Y_MAX

    # Scaling of x-and y-axis
    splot "fo1.txt" using (xmin+( $0-(ix+1)*column(-1) )*(xmax-xmin)/ix ) : (ymin+column(-1)*(ymax-ymin)/iy):1 w l

     
  • Ethan Merritt
    Ethan Merritt
    2012-02-07

    • status: open --> closed