# Plotting the same function with different parameters

How can I plot the same function with different parameters?

I want to get something like this:

For[i = 0, i < 4, i++, Show[Plot[Sin[x] + i, {x, 0, 2 Pi}]]].


This is just an example.

This is an alternative, perhaps more convenient depending on what you want to do with plot.

Plot[Evaluate[Sin[x] + # & /@ list], {x, 0, 2 Pi},
PlotRange -> {0, 7}, PlotLegends -> Automatic, PlotLegends ->
LineLegend[Automatic,LegendFunction -> (Framed[#1, FrameMargins -> 0]&)]] You can also use Table,

Plot[Evaluate@Table[Sin[x] + i, {i, 1, 6}], {x, 0, 2 Pi}, PlotRange -> {0, 7}] Or use SetDelay plus Range,

f[i_] := Sin[x] + i

Plot[Evaluate[f /@ Range], {x, 0, 2 Pi}, PlotRange -> {0, 7}]


You can use mapping instead of a for loop:

For instance, define the list of parameter to be changed:

list = {1, 2, 3, 4, 5, 6};


Then:

Show[Plot[Sin[x] + #, {x, 0, 2 Pi}, PlotRange -> {0, 7}] & /@ list] Have a look at how mapping works: http://reference.wolfram.com/language/ref/Map.html

It is very useful to write clean code.