Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8026305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:26:53+00:00 2026-06-04T23:26:53+00:00

Why when i make this code of gnuplot it’s work : set terminal postscript

  • 0

Why when i make this code of gnuplot it’s work :

set terminal postscript enhanced color
set output '../figs/ins_local.ps'

set title "Result"

set logscale y
set xrange [50:100]
set xtics 5

#set xlabel "Insertion"
#set ylabel "Time (in microseconds) "

plot sin(x)

but when i change plot sin(x) with :

plot "../myFile.final" with lines title "Somethings" lw 3  linecolor rgb "#29CC6A"

i have this error :

plot "../myFile.final" with lines title "Somethings" lw 3  linecolor rgb "#29CC6A"
                                                                                              ^
"local.gnuplot", line 16: all points y value undefined

I have juste one column ! it represente yrange. xrange is represented by number of line ! example of my datapoint :

125456
130000
150000

first point of x is 1, second point of x is 2, and last is 3. now i want to represente this 1, 2, 3 by a scale 50, 55, 60 !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:26:55+00:00Added an answer on June 4, 2026 at 11:26 pm

    There are a few things which could be going wrong here — without seeing your datafile it is impossible to tell. A couple which I can think of off the top of my head are:

    All your datapoints in column 2 are all less than or equal to 0 (You get the error message because log(0) is undefined)

    You don’t have any points in the first column between 50 and 100. In this case, all your datapoints get clipped out of the plot range because of set xrange [50:100]

    Your datafile only has 1 column…In this case, gnuplot doesn’t see any y-values. (change to plot '../myFile.final' u 1 ...)

    EDIT

    Ok, now that I see your datafile, the problem is definitely that you’ve set xrange [50:60] but your data’s xrange only runs from 0 to 2 (gnuplot starts datafile indexing from 0). The easiest way to fix this is to use the pseudo-column 0. Pseudo-column 0 is simply the line number starting from 0 (which is what gnuplot plots on the x axis if you do plot 'blah.txt' using 1. Here’s an example:

    scale_x(x,xmin,xmax,datamin,datamax)=xmin+(xmax-xmin)/(datamax-datamin)*x
    plot 'test.dat' using (scale_x($0,50,60,0,2)):1 w lines title "scaled xrange"
    

    Note that if you don’t know how the using specification works, numbers preceded by $ are element-wise operations on that whole column. For example:

    plot 'foo.bar' using 1:($2+$3) 
    

    will plot the first column plus the sum of the 2nd and third elements in each row of the datafile.

    This solution assumes that you know the maximum value of x in your datafile (in this case, that’s 3-1=2 — [three points, 0,1,2]). If you don’t know the number of datapoints, you can get that using shell magic, or directly from gnuplot. The first way is a little easier, although not as portable. I’ll show both:

    XMAX=`wc -l datafile | awk '{print $1-1}'` 
    scale_x(x,xmin,xmax,datamin,datamax)=xmin+(xmax-xmin)/(datamax-datamin)*x
    plot 'test.dat' using (scale_x($0,50,60,0,XMAX)):1 w lines title "scaled xrange"
    

    The second way, we need to make two passes through the data and let gnuplot pick up the maximum:

    set term push  #save terminal settings
    set term unknown #use unknown terminal -- doesn't actually make a plot, only collects stats
    plot 'test.dat' u 0:1 #collect stats
    set term pop   #restore terminal settings
    XMIN=GPVAL_X_MIN #should be 0, set during our first plot command
    XMAX=GPVAL_X_MAX #should be number of lines-1, collected during first plot command
    scale_x(x,xmin,xmax,datamin,datamax)=xmin+(xmax-xmin)/(datamax-datamin)*x
    plot 'test.dat' using (scale_x($0,50,60,XMIN,XMAX)):1 w lines title "scaled xrange"
    

    I suppose for completeness, I should say that this is also easier to do in gnuplot 4.6 (I don’t have it installed right now, so this next part just comes from my understanding of the docs):

    stats 'test.dat' using 0:1 name "test_stats"
    #at this point, your xmin/xmax are stored in the variables "test_stats_x_min"/max
    XMIN=test_stats_x_min
    XMAX=test_stats_x_max
    scale_x(x,xmin,xmax,datamin,datamax)=xmin+(xmax-xmin)/(datamax-datamin)*x
    plot 'test.dat' using (scale_x($0,50,60,XMIN,XMAX)):1 w lines title "scaled xrange"
    

    Gnuplot 4.6 looks pretty cool. I’ll probably start playing around with it pretty soon.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I make this code work? class Meta @array = [:a,:b] def self.method_missing(name,
I have this code and I need to make this work: if ($handle =
Is there a way to make this code work? LogonControl.java @Audit(AuditType.LOGON) public void login(String
I want to make this code work properly, what should I do? giving this
How do I make this code work in all browsers? <script> var $j =
is there a way to make this code work as intended? #include <iostream> using
Can anyone explain how to make this code work? echo '<div id=panel1-under>Welcome <?php echo
just wondering if someone can help me make this code work properly and be
I'm trying to figure out how to make this code work. Basically i have
How can i make this code work? TY! $site = '1' $mysites = array('1',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.