gnuplot horizontal


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting gnuplot horizontal
# 1  
Old 10-24-2011
gnuplot horizontal

simple question I thought.

How do I setup a chart in gnuplot that draws a "upper threshold" for a given set of data.

I have the graph charting fine. I have peaks and valleys. I can either setup a number that I want to be the "upper threshold". a horizontal line based either in the data, or set in the script. I cannot seem to figure out how to make that happen.

script:
Code:
#!/usr/local/bin/gnuplot
reset
set terminal png nocrop enhanced font "/usr/share/fonts/liberation/LiberationMono-Regular.ttf" 10 size 1200,600 xffffff
set output '/root/gnuplot/images/statvv-level3_threshold.png'
set xdata time
set grid
set key box outside below
set xtics 300

set format x "%m/%d/%y-%H:%M:%S"
set timefmt "%m/%d/%y-%H:%M:%S"
set xtics rotate by -90
set ytics auto
set ylabel "yAxisLabel"
set style data lines
set title "title of chart"
set key below

plot 'file_with_data' u 2:8 t 'title'

-=-=-=-=-=-

file_with_data looks like this:
Code:
330000 09/12/11-20:29:27          string01   t  278  278  278 13480 13480 13480 1.1 1.1  48.5  48.5    1
330000 09/12/11-20:29:37          string01   t  172  225  278 1793  7634 13480 0.4 0.8 10.4 34.0    0
330000 09/12/11-20:29:47          string01   t  241  230  278  7205  7491 13480 0.6 0.8  29.9  32.6    0
330000 09/12/11-20:29:57          string01   t  191  220  278 2526 6250 13480 0.6 0.7  13.2 28.4    0
330000 09/12/11-20:30:07          string01   t  263  229  278 2024 5405 13480 0.4 0.7   7.7 23.6    0
330000 09/12/11-20:30:17          string01   t  612  293  612 7321 5724 13480 0.7 0.7  12.0 19.6    0
330000 09/12/11-20:30:27          string01   t  224  283  612 4455 5543 13480 0.5 0.6  19.9 19.6    0
330000 09/12/11-20:30:37          string01   t  161  268  612 1045 4981 13480 0.2 0.6   6.5 18.6    0
330000 09/12/11-20:30:47          string01   t  159  255  612 1105 4550 13480 0.2 0.6   7.0 17.8    0
330000 09/12/11-20:30:57          string01   t  196  250  612 2684 4363 13480 0.3 0.6  13.7 17.5    0
330000 09/12/11-20:31:07          string01   t  325  256  612  8414 4732 13480 0.4 0.5 25.9 18.5    0
330000 09/12/11-20:31:17          string01   t  177  250  612  1346  4450 13480 0.5 0.5   7.6  17.8    0
330000 09/12/11-20:31:27          string01   t  307  254  612   6851  4635  13480  3.3 0.8  22.3  18.2    1
330000 09/12/11-20:31:37          string01   t  156  247  612   1906  4439  13480  3.3 0.9  12.3  18.0    1
330000 09/12/11-20:31:47          string01   t  187  243  612   2533  4312  13480  2.9 1.0  13.5  17.7    1
330000 09/12/11-20:31:58          string01   t  241  243  612   2102  4173  13480  3.1 1.1   8.7  17.2    1
330000 09/12/11-20:32:08          string01   t  134  237  612   1359   4006  13480 3.4 1.2  10.1  16.9    0
330000 09/12/11-20:32:18          string01   t  201  235  612   3062   3953  13480 3.2 1.3  15.2  16.9    0
330000 09/12/11-20:32:28          string01   t  251  235  612  14184   4496  14184  2.7 1.4  56.5  19.1    6


I hope the formatting renders correctly.

column1 has been added so I can "pull" the horizontal line value from the data set. I can remove it. I want to just add a horizontal line across the chart, at 330000 relative to the scale.

thanks


Moderator's Comments:
Mod Comment Video tutorial on how to use code tags in The UNIX and Linux Forums.

Last edited by Franklin52; 10-25-2011 at 04:20 AM.. Reason: Please use code tags, thank you
# 2  
Old 10-24-2011
You need provide the expect output. If you need add empty line on each data set, try this:
Code:
sed G file_with_data

# 3  
Old 10-24-2011
I think you misunderstood. I want to chart a straight line through the chart. the data is irrelevant, but presented for illustration. I just want to chart the columns, with a timeline at the bottom, but I want a line horizontal through the chart.
# 4  
Old 10-24-2011
Oh, then you have to look for the solution in that command
Code:
man gnuplot

# 5  
Old 10-26-2011
that is not helpful. I'm attempting to create a horizontal "reference line" I believe. Can anyone provide a pointer? the script above does plot, the data is the essential structure. double spacign the dataset will not accomplish anything.

anyone with experience want to look at this issue?
# 6  
Old 10-28-2011
Hi.

Here is a quick solution to get a horizontal line. I commented out most of your command file and added a function. Then, on the dumb terminal I plotted the data and the function on the same plot:
Code:
#!/usr/bin/env bash

# @(#) s1	Demonstrate overlay plot, straight line in gnuplot.
# See:
# http://www.ibm.com/developerworks/library/l-gnuplot/
#
# http://www.gnuplot.info/docs_4.2/gnuplot.html

# Section 1, setup, pre-solution, $Revision: 1.23 $".
# Infrastructure details, environment, debug commands for forum posts. 
# Uncomment export command to run script as external user.
# export PATH="/usr/local/bin:/usr/bin:/bin" HOME=""
set +o nounset
pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
edges() { _n="$1" _f="$2";head -n $_n $_f; pe "  ---";tail -n $_n $_f ; }
db() { ( printf " db, ";for _i;do printf "%s" "$_i";done;printf "\n" ) >&2 ; }
db() { : ; }
C=$HOME/bin/context && [ -f $C ] && $C gnuplot
set -o nounset
pe

FILE=${1-g1}

# Display sample of data file(s).
db " Section 1: display of input data."
pe " || start sample "
edges 3 $FILE
pe
edges 3 data1
pe " || end"

# Section 2, solution.
pl " Results:"
db " Section 2: solution."
gnuplot g1

exit 0

producing:
Code:
% ./s1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution        : Debian GNU/Linux 5.0.8 (lenny) 
GNU bash 3.2.39
gnuplot 4.2 patchlevel 2 

 || start sample 
reset
# set terminal png nocrop enhanced font "/usr/share/fonts/liberation/LiberationMono-Regular.ttf" 10 size 1200,600 xffffff
set terminal dumb 50 20
  ---
strate(x) = 330000
plot 'data1', strate(x)
exit

1 0
2 110000
3 220000
  ---
3 220000
4 330000 
5 440000
 || end

-----
 Results:


  450000 ++---+----+---+----+----+----+---+---+A
         +    +    +   +    +    +    +   +    +
  400000 ++...................................++
  350000 ++...................................++
         #############################A#########
  300000 ++...................................++
  250000 ++...................................++
         |    :    :   :    A    :    :   :    |
  200000 ++...................................++
  150000 ++...................................++
         |    :    :   :    :    :    :   :    |
  100000 ++........A..........................++
   50000 ++...................................++
         +    +    +   +    +    +    +   +    +
       0 A+---+----+---+----+----+----+---+---++
         1   1.5   2  2.5   3   3.5   4  4.5   5
            +-'data1'---A---strate(x)-######+
            +-------------------------------+

See links in script for more information ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Print vertical to horizontal

Hi Masters, I need help to change my vertical data to horisontal input 2015-04-13|JS|741667 2015-04-13|JSJ|2272 2015-04-13|TMS|107099 2015-04-12|JMD|47945 2015-04-13|TM|760024 2015-04-13|JM|484508 2015-04-14|JMJ|318 2015-04-14|JSD|54436 2015-04-13|JM|15410 Output... (2 Replies)
Discussion started by: radius
2 Replies

2. UNIX for Dummies Questions & Answers

Change Vertical to Horizontal

I need to change data from vertical to horizontal but with condition input USA|80 AUS|40 BRA|33 VEGAS|40 KENTUCKY|50 NEWYORK|21 DARWIN|33 ADELAIDE|21 SAOPAOLO|44 RIO|89 GAPIZA|44 BENFLEX|32 AXIS|44 ACRE|56 HEIGHT|22 (5 Replies)
Discussion started by: radius
5 Replies

3. Shell Programming and Scripting

How do i do the vertical to horizontal??

51009 8746 8912 17986 20315 24998 5368 38934 7805 8566 (4 Replies)
Discussion started by: nikhil jain
4 Replies

4. Shell Programming and Scripting

Output with horizontal formats

// AIX 5.3 & 6.1 This command powermt display dev=all returns the output of Pseudo name=hdiskpower50 Symmetrix ID=000190101757 Logical device ID=05F0 state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ==============================================================================... (2 Replies)
Discussion started by: Daniel Gate
2 Replies

5. Shell Programming and Scripting

Vertical And Horizontal Pivoting

Hi All, My Input data is: A=1 B=2 My desired Output should be: A|B 1|2 Thanks in advance... (3 Replies)
Discussion started by: kmsekhar
3 Replies

6. UNIX for Dummies Questions & Answers

vertical to horizontal

dear all, i'm new to unix and i try to figure out the best case for making list of vertical text to become horizontal and skip the line 1 and 2. example text : Data DATE XXXXX MAX 47 53 49 51 48 48 7 46 51 8 25 (6 Replies)
Discussion started by: andrisetia
6 Replies

7. UNIX for Dummies Questions & Answers

Horizontal to vertical

Hi, Silly question, if I have an excel file that looks something like this: ................. Subject 1 Subject 2 Subject 3 Subject 4 Fever..............13...........9.............23..........14 Headache.........2............12...........18..........23... (3 Replies)
Discussion started by: Xterra
3 Replies

8. Shell Programming and Scripting

count horizontal data

dear all.. i need help i have data ID,A,B,C,D,E,F,G,H --> header 917188,4,1,2,1,4,6,3,5 --> data i want output : ID,OUT1,OUT2,OUT3 --> header 917188,3,3,2 where OUT1 is count of 1 and 2 from $2-$9 OUT2 is count of 3 and 4 from $2-$9... (3 Replies)
Discussion started by: buncit8
3 Replies

9. Linux

Horizontal Lines

Jan 18, 2010 14:15:31 GMT Hello, I get horizontal black lines after each line of text and every blank line is colored black. I am using HP Color LaserJet... (5 Replies)
Discussion started by: H_P
5 Replies

10. Shell Programming and Scripting

Vi horizontal scrolling

I have to look through logfiles where lines are several hundred characters long and if I open the log in Vi it automatically word wraps the line. In Vim you can use the -nowrap option to stop this, but how can you do this in Vi? I ask because I don't want to see the whole line, just the first few... (8 Replies)
Discussion started by: rupweb
8 Replies
Login or Register to Ask a Question