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
Graphics, Figures & Tables ⇒ Altering data file values
Altering data file values
Last edited by jhapk on Sat Jul 31, 2010 10:01 pm, edited 1 time in total.
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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Altering data file values
The \thisrow command helped me do it. Something like
solves the problem.
Code: Select all
\addplot table [x expr=(\thisrow{x}-1)/2/\thisrow{x} ,y=Y]{name_of_datafile};