# How to stack several vector plots using StreamPlot?

I would like to plot several stream plots as is in ref/StreamPlot (Mathematica 12).

As is reported in the section: Generate a list of stream plots of varying [Lambda]:

I did not change but it does not work as this example.

The problem is, there is field that may represent a bidimensional vector (Electric,Acoustic), this is the code.

a = 1; b = 1;  (* fixed values, constants *)

f1 = (-y  l )/(y^2 + a x^2);

f2 = ( x l )/(b y^2 + x^2);

l = {-1, 0, 1};  (* This can take several values *)

plots = MapIndexed[
Function[{f1, f2},
StreamPlot[{f1, f2}, {x, -3, 3}, {y, -3, 3}, StreamPoints -> 16,
StreamScale -> 0.07,
StreamStyle -> ColorData["SolarColors"][0.3 l[]]]], l]

plotSpacing = 5;
stackPlots[plots, plotSpacing, Axes -> True, Boxed -> False,
Ticks -> {Automatic, Automatic,
MapIndexed[{plotSpacing #2[], Row[{"l = ", #1}]} &, values]}]


It does not work, only the constant value is plotted. the function can not take different values as must be. This function does not evaluate the vector.Thanks!

Do you mean this plot?

a = 1; b = 1;(*fixed values,constants*)
f1 = (-y l)/(y^2 + a x^2);
f2 = (x l)/(b y^2 + x^2);
Function[{f1, f2},
StreamPlot[{f1, f2}, {x, -3, 3}, {y, -3, 3}, StreamPoints -> 16,
StreamScale -> 0.07,
StreamStyle -> ColorData["SolarColors"][0.3 ]]] @@@
Table[{f1, f2}, {l, {-1, 0, 1}}]

Table[StreamPlot[{f1, f2}, {x, -3, 3}, {y, -3, 3}, StreamPoints -> 16,
StreamScale -> 0.07,
StreamStyle -> ColorData["SolarColors"][0.3 ]], {l, {-1, 0, 1}}] • @Moo The main problem is MapIndexed not right here since we know that MapIndexed[g[#1, #2] &, {-1, 0, 1}] is {g[-1, {1}], g[0, {2}], g[1, {3}]}. Jul 22, 2021 at 14:58