Gnuplot Same Data Two Axes Different Units)

 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications Gnuplot Same Data Two Axes Different Units)
# 1  
Old 06-02-2013
Data Gnuplot Same Data Two Axes Different Units)

I'm pretty familiar with Gnuplot, but I've never actually come across a reasonable solution to this problem and I'm hoping someone can help me out! I think it's because I don't know how to pose the problem neatly, so please bare with me. Also new to the forum....so yeah...

I have one data set (x vs y), but I'd like to have y plotted in two different units in the same plot. For instance, I want x1y1 to be x vs y and x1y2 to be x vs 1/y, so that I don't actually plot the data twice. So there would be one line, and if you looked at the left axis you'd see the y value in one unit, and the right axis would have that same value in another "unit".

Below is an example of what I'm looking for, but rotated 90degrees. Here, x2=1240/x1, and there would be one data curve that could be understood using either x1 or x2.
Image

Any help would be awesome and greatly appreciated!

Moderator's Comments:
Mod Comment edit by bakunin: i moved your thread to "Unix and Linux Applications", as GNUplot is such an application. "Unix for Dummies" is for beginner-topics about problems related to UNIX itself.

Last edited by bakunin; 06-03-2013 at 07:19 AM..
# 2  
Old 06-03-2013
So, you want two different units for y? I think this will help:

Code:
set y2range [othermin:othermax]
set y2tics
set ytics nomirror

# 3  
Old 06-03-2013
Thanks for the reply! But I think that's the result I'm trying to avoid....

That would mean I have to plot my dataset twice, and the left and right axes would both be linear or a logscale or whatever I chose, right?

I guess another what to phrase what I'm looking for is that I want the right axis to be a transform of the left axis's y-value. So it would look like this

Code:
y1    ->Directly Across-> y2
4-----------------------------1/4
3-----------------------------1/3
2-----------------------------1/2
1-----------------------------1
0.5---------------------------2

So, see the y2 axis has to be aligned with a specific value on y1.
The only way I can think of doing it is if I make a graph with a set scale on y1 and x1, and then add labels manually to y2. So for instance....

Code:
set xrange [0:1]
set yrange [2:4]
set label "1/2" at first 1,first 2
set label "1/3" at first 1,first 3
set label "1/4" at first 1,first 4

But I was hoping there's something more elegant and flexible....?

I'll try and upload a better image of what I'm talking about because I think my words are muddled...

Last edited by Scott; 06-03-2013 at 02:06 PM.. Reason: Please use code tags for code and data
# 4  
Old 06-03-2013
They don't have to be both linear or log or whatever, they're independent. It won't match the second axis marking for you however, you have to make it do so yourself via formulas or what have you.

Just put two lines into the same plot command, separating with commas.

Last edited by Corona688; 06-03-2013 at 01:43 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Gnuplot Time Data Question

I have a data file of the following format: servername,2013-05-11 17:46:03,SomeText,195,195,11,202 servername,2013-05-11 17:47:03,SomeText,192,192,23,103 servername,2013-05-11 17:48:03,SomeText,189,190,14,117 servername,2013-05-11 17:49:03,SomeText,196,195,24,231 ... ... I want to... (0 Replies)
Discussion started by: BeeryM
0 Replies

2. Shell Programming and Scripting

Parsing file: preparing data for charts (gnuplot, calc,...)

Hi there, I have files (tsv) like this: CTLPort IO Rate(IOPS) Read Hit(%) Write Hit(%) Timestamp 0A 136 97 100 09:36:48 0B 3 100 100 09:36:48 0C 88 35 100 09:36:48 0A 87 100 100 09:37:49 0B 3 97 100 09:37:49 0C 83 45 100 09:37:49 0A 108 83 100 09:38:48 0B 3 100 100 09:38:48... (1 Reply)
Discussion started by: gray380
1 Replies

3. Shell Programming and Scripting

placeholder in gnuplot data

My input data has occasional holes in it, spots where a sensor couldn't be read. These are ERR in the data file instead of a floating point number. What should I change them to, for gnuplot to ignore these values instead of whining about them? (1 Reply)
Discussion started by: Corona688
1 Replies

4. UNIX for Dummies Questions & Answers

Fitting data in gnuplot with xyerrorbars

I was looking at the examples that show how to fit data using gnuplot (ex: gnuplot / misc (2E)) but I can't find a place that shows what to do if I have ranges for the x and y error bars. I tried the common sense: gnuplot> fit f(x) "data.txt" using 3:6:4:5:7:8 via a,b ... (8 Replies)
Discussion started by: cosmologist
8 Replies

5. Programming

GNUPLOT- how to change the style of data points

Hi, I am trying to arrange my graphs with GNUPLOT. Although it looked like simple at the beginning, I could not figure out an answer for the following: I want to change the style of my data points (not the line, just exact data points) The terminal assigns first + and then x to them but what I... (0 Replies)
Discussion started by: natasha
0 Replies

6. Hardware

Units in server racks

What does the term units mean in the context of server racks, for instance 4U? It is an indication of height, so does that mean the amount of disks the rack can hold or can the rack hold multiple motherboards / processors? (8 Replies)
Discussion started by: figaro
8 Replies

7. UNIX for Advanced & Expert Users

Gnuplot question: plotting 3D data in map view

I have a simple gnuplot question. I have a set of points (list of x,y,z values; irregularly spaced, i.e. no grid) that I want to plot. I want the plot to look like this: - map view (no 3D view) - color of each point should depend on z-value. - I want to define my own color scale - plot should... (1 Reply)
Discussion started by: karman
1 Replies
Login or Register to Ask a Question