Graphics, Figures & TablesAltering data file values

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Altering data file values

Post by jhapk »

Hi,

I have a data file like this:

x Y
0.2 0.5
0.4 0.6
0.5 0.5

I want to plot Y vs F(x), where F(x) = a simple mathematical function of x, e.g. F(x) = (x-1)/2/x

How can I use pgfplots to do this?

Thanks
Last edited by jhapk on Sat Jul 31, 2010 10:01 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Altering data file values

Post by localghost »

These kinds of plots are clearly explained in the pgfplots manual.


Best regards
Thorsten
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Altering data file values

Post by jhapk »

The \thisrow command helped me do it. Something like

Code: Select all

\addplot table [x expr=(\thisrow{x}-1)/2/\thisrow{x} ,y=Y]{name_of_datafile}; 
solves the problem.
Post Reply