2
$\begingroup$
  1. I am trying to enlarge the plots. They are too small. In particular, I would like the intersection of the curves (sav-curves and depr-curves) to be more evident. Where and how do I implement this?
  2. I want to change the plot legends to have custom labels. As you can see in the image below, my code produces inappropriate labels.

Here is my code:

prodA[k_, a_] := a*k^0.5;
prodB[k_, b_, c_] := b*k^(0.5) - c;
depr[k_, d_] := d*k;
savA[k_, s_, a_] := s*prodA[k, a];
savB[k_, s_, b_, c_] := s*prodB[k, b, c];
depr[k_, d_] := d*k;
Manipulate[
 If[default, {s = .3, δ = .02, a = 1, range = 30, 
   default = False}, Null];
 Column[{
   Plot[{ConditionalExpression[prodA[k, a], 0 <= k < (c/(b - a))^2], 
     ConditionalExpression[prodB[k, b, c], (c/(b - a))^2 <= k],
        depr[k, d],
        ConditionalExpression[savA[k, s, a], 0 <= k < (c/(b - a))^2], 
     ConditionalExpression[savB[k, s, b, c], (c/(b - a))^2 <= k]},
        {k, 0, range}, 
    PlotStyle -> {LightRed, LightBlue, Orange, Red, Blue}, 
    PlotRange -> {{-70, range}, {-9.9, 37}}, 
    PlotLegends -> "Expressions"],
   Plot[{ConditionalExpression[savA[k, s, a]/k, 
      0 <= k < (c/(b - a))^2], 
     ConditionalExpression[savB[k, s, b, c]/k, (c/(b - a))^2 <= k],
      depr[k, d]/k}, {k, 0, range}, PlotStyle -> {Red, Blue, Orange}, 
    PlotRange -> {{-70, range}, {-9.9, 37}}, 
    PlotLegends -> "Expressions"]}],
 {{s, .3, "savings rate γ"}, .05, 1, Appearance -> "Labeled"},
 {{d, .5, "depreciation rate δ"}, .015, 2, 
  Appearance -> "Labeled"},
 {{a, 4, "technology A"}, 1, 5, Appearance -> "Labeled"},
 {{b, 5, "technology B"}, 5, 10, Appearance -> "Labeled"},
 {{c, 4, "setup cost c"}, 4, 10, Appearance -> "Labeled"},
 {{range, 150, "plot range"}, 30, 300, Appearance -> "Labeled"},
 Button["reset", {s = .3, d = .5, a = 4.9, b = 5, c = 4, range = 150, 
    default = False} &]]

enter image description here

$\endgroup$
  • $\begingroup$ Manuel, welcome to mma.se. Please remember, when you see good questions and answers, to vote them up by clicking the gray triangles, and to accept the answer, if any, that solves your problem by clicking the checkmark sign. $\endgroup$ – kglr Jul 4 '17 at 13:10
5
$\begingroup$

For enlarging the plots, use the option ImageSize within the Plot command and specify your own entries for PlotLengeds in a list.

prodA[k_, a_] := a*k^0.5;
prodB[k_, b_, c_] := b*k^(0.5) - c;
depr[k_, d_] := d*k;
savA[k_, s_, a_] := s*prodA[k, a];
savB[k_, s_, b_, c_] := s*prodB[k, b, c];
depr[k_, d_] := d*k;
Manipulate[
 If[default, {s = .3, \[Delta] = .02, a = 1, range = 30, 
   default = False}, Null];
 Column[{
   Plot[{
     ConditionalExpression[prodA[k, a], 0 <= k < (c/(b - a))^2], 
     ConditionalExpression[prodB[k, b, c], (c/(b - a))^2 <= k], 
     depr[k, d], 
     ConditionalExpression[savA[k, s, a], 0 <= k < (c/(b - a))^2], 
     ConditionalExpression[savB[k, s, b, c], (c/(b - a))^2 <= k]}, {k,
      0, range}, PlotStyle -> {LightRed, LightBlue, Orange, Red, Blue},
    PlotRange -> {{-70, range}, {-9.9, 37}},
    PlotLegends -> {"Döpp", "Döpp", "Döpp", "dö", "dö"},
    ImageSize -> 360
    ],
   Plot[{
     ConditionalExpression[savA[k, s, a]/k, 0 <= k < (c/(b - a))^2], 
     ConditionalExpression[savB[k, s, b, c]/k, (c/(b - a))^2 <= k], 
     depr[k, d]/k}, {k, 0, range}, PlotStyle -> {Red, Blue, Orange},
    PlotRange -> {{-70, range}, {-9.9, 37}},
    PlotLegends -> {"döpp", "döpp", "döpp!"},
    ImageSize -> 360
    ]}],
 {{s, .3, "savings rate \[Gamma]"}, .05, 1, Appearance -> "Labeled"},
 {{d, .5, "depreciation rate \[Delta]"}, .015, 2, 
  Appearance -> "Labeled"}, {{a, 4, "technology A"}, 1, 5, 
  Appearance -> "Labeled"},
 {{b, 5, "technology B"}, 5, 10, Appearance -> "Labeled"},
 {{c, 4, "setup cost c"}, 4, 10, 
  Appearance -> "Labeled"}, {{range, 150, "plot range"}, 30, 300, 
  Appearance -> "Labeled"}, 
 Button["reset", {s = .3, d = .5, a = 4.9, b = 5, c = 4, range = 150, 
    default = False} &]
 ]

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.