Hello everybody!
I am trying to create a graph displaying the substitution effects of a change (decrease) in the price of good Y and I am trying to combine the legends for each function. I am somewhat new to Mathematica and have reached a roadblock. It seems like I need to use PlotLegends but I don't understand what I need to do. Here are two versions of my attempts:
f[x_] := 4/x
g[x_] := 9/x
a[x_] := -1 x + 6
b[x_] := -2.25 x + 6
h[x_] := -1 x + 4
pos = {Right, Top};
Show[{Plot[f[x], {x, -6, 15}, PlotStyle -> Blue],
Plot[g[x], {x, 0, 15}, PlotStyle -> Green],
Plot[a[x], {x, 0, 6}, PlotStyle -> Red],
Plot[b[x], {x, 0, 2.667}, PlotStyle -> Red],
Plot[h[x], {x, 0, 4.1}, PlotStyle -> Yellow]},
ListPlot[{f[x], g[x], a[x], b[x], h[x]} -> {"\[ScriptCapitalU]",
"\[ScriptCapitalU]'", "After Price\[DifferenceDelta]",
"Before Price\[DifferenceDelta]", "Hypothetical Budget Line"},
ListPlot[{{1.333, 3}, {2, 2}, {3, 3}} -> {"A", "B", "C"}] ,
GridLines -> Automatic, PlotRange -> {{0, 10}, {0, 6.5}},
AxesOrigin -> {0, 0},
AxesLabel -> {HoldForm[Good x], HoldForm[Good y]},
PlotLabel -> HoldForm[Price of good y is cheaper],
LabelStyle -> {GrayLevel[0], Bold, Italic}]]
Second attempt:
f[x_] := 4/x
g[x_] := 9/x
a[x_] := -1 x + 6
b[x_] := -2.25 x + 6
h[x_] := -1 x + 4
pos = {Right, Top};
Show[{Plot[f[x], {x, -6, 15}, PlotStyle -> Blue,
PlotLegends -> "\[ScriptCapitalU]"],
Plot[g[x], {x, 0, 15}, PlotStyle -> Green,
PlotLegends -> "\[ScriptCapitalU]'"],
Plot[a[x], {x, 0, 6}, PlotStyle -> Red,
PlotLegends -> "After Price\[DifferenceDelta]"],
Plot[b[x], {x, 0, 2.667}, PlotStyle -> Red,
PlotLegends -> "Before Price\[DifferenceDelta]"],
Plot[h[x], {x, 0, 4.1}, PlotStyle -> Yellow,
PlotLegends -> "Hypothetical Budget Line"]},
ListPlot[{{1.333, 3}, {2, 2}, {3, 3}} -> {"A", "B", "C"}] ,
GridLines -> Automatic, PlotRange -> {{0, 10}, {0, 6.5}},
AxesOrigin -> {0, 0},
AxesLabel -> {HoldForm[Good x], HoldForm[Good y]},
PlotLabel -> HoldForm[Price of good y is cheaper],
LabelStyle -> {GrayLevel[0], Bold, Italic}]
Thank you so much for your help!