4
$\begingroup$

Lets say I have function $f[x,y]$, I would like to plot this function for particular combinations (x,y) which I have at another list:

Points = {{x1,y1}, {x2,y2}, ...};

Intuitively speaking it should look like this

ListLogPlot[f[x,y] /. {x,y}->Points]

But of course it is not correct syntax and I am not sure how to make this work. Do anyone have any ideas?

EDIT:

Dear Halirutan, your solution works, but how can I choose which variable (x or y) would be on the x-axis of the plot?

$\endgroup$
  • 2
    $\begingroup$ Something along ListLogPlot[f@@@Points] should work. $\endgroup$ – halirutan Jul 6 '17 at 11:21
  • $\begingroup$ ListLogPlot[Transpose[f@@@Points]] if you want to switch x and y axis $\endgroup$ – mmeent Jul 6 '17 at 12:05
  • $\begingroup$ @winten: In general, you will receive far better answers when you include a small (!) example that actually shows what you are trying. Include a sample function and points. It was not clear that f is a function f: R^2 -> R^2 which is why you had to make a clarification. $\endgroup$ – halirutan Jul 6 '17 at 12:17
3
$\begingroup$

It's just an idea because it lacks information:

Points = {{1, 2}, {2, 4}, {3, 7}, {4, 12}};
MapThread[f, Points];
f[x_, y_] := {x, y*200}
ListLogPlot[f @@@ Points]
$\endgroup$
2
$\begingroup$

In other situations you might have a look at Map (/@)

Vector of value pairs

m1 = RandomInteger[{1, 10}, {10, 2}];

Matrix of value pairs

m2 = Partition[m1, 5];

Some function

f[{x_, y_}] := x*y

Plot vector

ListLogPlot[f /@ m1, Joined -> True, AxesOrigin -> {1, 0}]

enter image description here

Plot matrix

ListLogPlot[Map[f, m2, {2}], Joined -> True, AxesOrigin -> {1, 0}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.