LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-29-2008, 10:20 PM   #1
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Rep: Reputation: 67
gnuplot - plot horizontal line over shorter range than the axis


For example:

I am plotting a parabola.

I'd like to plot a horizontal line that spans from the left to right wall of the curve. I'd like the horizontal line to stop at each intersection, forming an upside-down 'A'

Is there an easy way to do this?
 
Old 07-30-2008, 03:32 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
of the curve? What curve? This sounds like homework.
 
Old 07-30-2008, 03:48 PM   #3
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Original Poster
Rep: Reputation: 67
Hah, no, it's not homework. I just used curve as a generic term. And a parabola for simplicity. I'm actually plotting electronic potential curves for diatomic molecules and the horizontal line is supposed to be the total energy.

Code:
set xrange [-5:5]

plot x**2 with lines lt 1 title "y = x^2", \
     4    with lines lt 1 title "y = 4, -2 <= x <= 2"
So for this I want to plot the parabola, but I only want the horizontal line to go from -2 to 2.
 
Old 07-30-2008, 05:27 PM   #4
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
ahh.. well, I suppose the answer relates to how much you want to do. Certainly you can draw a line between any two points on the screen, so if you don't mind figuring the intersection points externally, it would be pretty easy to plot from, say -2,4 to 2,4 and so on, but if you're looking for something like a "trim" function that trims a line at a given point, I don't know of one (which does not necessarily mean that it's not possible).
 
Old 07-30-2008, 06:22 PM   #5
ne pas
Member
 
Registered: Jul 2008
Posts: 55

Rep: Reputation: 23
Is this useful for you?
Code:
set xrange [-5:5]

plot x**2 title "y = x^2" with lines lt 1, \
     x**2 notitle with filledcurves below y1=4
 
Old 10-18-2008, 08:41 AM   #6
kotzyba
LQ Newbie
 
Registered: Oct 2008
Posts: 1

Rep: Reputation: 0
Code:
set arrow 10 from -2,4 to 2,4 nohead
use this code before ploting
you can unset the arrow with
Code:
unset arrow 10
hope it helps
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gnuplot: how to label x-axis with strings from data file? hedpe Linux - Software 2 07-11-2006 10:21 AM
in gnuplot; move title in plot command? shengchieh Linux - Software 0 12-29-2004 12:42 PM
vi style command line editing in gnuplot 3.7 sirclif Linux - Software 0 09-20-2004 12:47 PM
Horizontal line across screen. Tarts Linux - Laptop and Netbook 5 11-01-2003 01:02 PM
gnuplot vertical line tucolino Linux - Software 2 10-08-2003 04:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration