Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

My first post regarding this matter was not well formulated so hopefully I have done a better job of reformulated my question here. The following code works well as far as it goes.

Manipulate[If[run == 20, run = 0];

 Module[
  {k1 = 0.2, k2 = 0.4, w = 1.3, A = 0.05, c = 0.01, L = 6},

  M[x_, y_, L_] := 
   Piecewise[{{0, y - L Sin[x] < 0}, {1, y - L Sin[x] > 0}}]*(y - 
      L Sin[x]);
  P[x_, y_, L_] := 
   Piecewise[{{0, y + L Sin[x] < 0}, {1, y + L Sin[x] > 0}}]*(y + 
      L Sin[x]);

  sys = {x''[t] + c x'[t] - 
      k1 Cos[x[t]] (M[x[t], y[t], 6] - P[x[t], y[t], 6]) == A Sin[w t],
    y''[t] + c y'[t] + k2 (M[x[t], y[t], 6] + P[x[t], y[t], 6]) == 
     9.8};

  ic = {x[0] == x0, x'[0] == xp0, y[0] == y0, y'[0] == yp0};
  sol = NDSolve[{sys, ic}, {x, y}, {t, 0, 20}]];

 {x1[t_], y1[t_]} = {x[t], y[t]} /. Flatten[sol];
 l = 2 + 0.10 y1[run];
 p = 0;
 q = 1.8;

 GraphicsGrid[{{Graphics[{Line[{{-5.5, -0.6}, {5.5, -0.6}}], 
      Line[{{-5, 3.8}, {-5, q - (.9 l + 0.6 - 5*Sin[x1[run]])}}], 
      Line[{{5, 3.8}, {5, q - (.9 l + 0.6 + 5*Sin[x1[run]])}}], Brown,
       Thickness[0.02], 
      Line[{{p - 5, q - (.9 l + 0.6 - 5*Sin[x1[run]])}, {p + 5, 
         q - (.9 l + 0.6 + 5*Sin[x1[run]])}}]},
     PlotRange -> {{-6, 6}, {-4, 6}}]}}, ImageSize -> {800, 600}],

 {{x0, 0, "\!\(\*SubscriptBox[\(\[Theta]\), \(0\)]\)"}, -\[Pi]/
   6, \[Pi]/6, 0.001, 
  Appearance -> "Labeled"}, {{xp0, 0, 
   "\!\(\*SubscriptBox[OverscriptBox[\(\[Theta]\), \(.\)], \
\(0\)]\)"}, -1, 1, 
  Appearance -> "Labeled"}, {{y0, 27.25, 
   "\!\(\*SubscriptBox[\(y\), \(0\)]\)"}, -30, 30, 
  Appearance -> "Labeled"}, {{yp0, 0, 
   "\!\(\*SubscriptBox[OverscriptBox[\(y\), \(.\)], \(0\)]\)"}, -10, 
  10, Appearance -> "Labeled"}, {{run, 0, 
   Text[Style["release system", FontSize -> 18]]}, 0, 20, .01, 
  ControlType -> Trigger, AnimationRate -> 1}, 
 SynchronousUpdating -> True, AutorunSequencing -> {1, 2}, 
 ControlPlacement -> Left, TrackedSymbols -> True, 
 FrameLabel -> 
  Style["Vertical and transverse motion of the Tacoma Narrows Bridge \
roadway", 20, FontFamily -> "Times"]]

Here is an image the code produces:full size graphic

I want to place a label to the immediate right of the horizontal bar generated by the above code. To do this I have wrapped the Labeled command around GraphicsGrid above with the code block below:

GraphicsGrid[{{Labeled[
    Graphics[{Line[{{-5.5, -0.6}, {5.5, -0.6}}], 
      Line[{{-5, 3.8}, {-5, q - (.9 l + 0.6 - 5*Sin[x1[run]])}}], 
      Line[{{5, 3.8}, {5, q - (.9 l + 0.6 + 5*Sin[x1[run]])}}], Brown,
       Thickness[0.02], 
      Line[{{p - 5, q - (.9 l + 0.6 - 5*Sin[x1[run]])}, {p + 5, 
         q - (.9 l + 0.6 + 5*Sin[x1[run]])}}]},
     PlotRange -> {{-6, 6}, {-4, 6}}], Text["Equilibrium"], Right, 
    LabelStyle -> Red]}}, ImageSize -> {800, 600}]

I have included the resulting image of the now shrunken graphic. How can I keep the graphic full size? shrunken graphic with label

Thanks.

share|improve this question

1 Answer 1

Using

Manipulate[If[run == 20, run = 0];
 Module[{k1 = 0.2, k2 = 0.4, w = 1.3, A = 0.05, c = 0.01, L = 6}, 
  M[x_, y_, L_] :=  Piecewise[{{0, y - L Sin[x] < 0}, {1, y - L Sin[x] > 0}}]*(y - L Sin[x]);
  P[x_, y_, L_] :=  Piecewise[{{0, y + L Sin[x] < 0}, {1, y + L Sin[x] > 0}}]*(y + L Sin[x]);
  sys = {x''[t] + c x'[t] - k1 Cos[x[t]] (M[x[t], y[t], 6] - P[x[t], y[t], 6]) ==  A Sin[w t],  
         y''[t] + c y'[t] + k2 (M[x[t], y[t], 6] + P[x[t], y[t], 6]) ==  9.8};
  ic = {x[0] == x0, x'[0] == xp0, y[0] == y0, y'[0] == yp0};
  sol = NDSolve[{sys, ic}, {x, y}, {t, 0, 20}]];
 {x1[t_], y1[t_]} = {x[t], y[t]} /. Flatten[sol];
 l = 2 + 0.10 y1[run];
 p = 0;
 q = 1.8;
 Labeled[Graphics[{Line[{{-5.5, -0.6}, {5.5, -0.6}}], 
    Line[{{-5, 3.8}, {-5, q - (.9 l + 0.6 - 5*Sin[x1[run]])}}], 
    Line[{{5, 3.8}, {5, q - (.9 l + 0.6 + 5*Sin[x1[run]])}}], Brown,   Thickness[0.02], 
    Line[{{p - 5, q - (.9 l + 0.6 - 5*Sin[x1[run]])}, {p + 5, 
           q - (.9 l + 0.6 + 5*Sin[x1[run]])}}]}, 
   PlotRange -> {{-6, 6}, {-4, 6}}, ImageSize -> {400, 300}], 
  Text["Equilibrium"], Right, 
  LabelStyle -> Red], {{x0, 0, 
   "\!\(\*SubscriptBox[\(θ\), \(0\)]\)"}, -π/6, π/6, 
  0.001, Appearance -> "Labeled"}, {{xp0, 0, 
   "\!\(\*SubscriptBox[OverscriptBox[\(θ\), \(.\)], \
\(0\)]\)"}, -1, 1, 
  Appearance -> "Labeled"}, {{y0, 27.25, 
   "\!\(\*SubscriptBox[\(y\), \(0\)]\)"}, -30, 30, 
  Appearance -> "Labeled"}, {{yp0, 0, 
   "\!\(\*SubscriptBox[OverscriptBox[\(y\), \(.\)], \(0\)]\)"}, -10, 
  10, Appearance -> "Labeled"}, {{run, 0, 
   Text[Style["release system", FontSize -> 18]]}, 0, 20, .01, 
  ControlType -> Trigger, AnimationRate -> 1}, 
 SynchronousUpdating -> True, AutorunSequencing -> {1, 2}, 
 ControlPlacement -> Left, TrackedSymbols -> True, 
 FrameLabel -> Style["Vertical and transverse motion of the Tacoma Narrows Bridge roadway", 20, FontFamily -> "Times"]]

Mathematica graphics

But personally, I would remove the Labeled[] thing and use just a Text inside Graphics:

Graphics[{
  Line[{{-5.5, -0.6}, {5.5, -0.6}}], , 
  Text[Style["Equilibrium", Medium, Bold, Red], {7, -.6}],
  Line[{{-5, 3.8}, {-5, q - (.9 l + 0.6 - 5*Sin[x1[run]])}}],
  Line[{{5, 3.8}, {5, q - (.9 l + 0.6 + 5*Sin[x1[run]])}}],
  Brown, Thickness[0.02], 
  Line[{{p - 5, q - (.9 l + 0.6 - 5*Sin[x1[run]])},
    {p + 5, q - (.9 l + 0.6 + 5*Sin[x1[run]])}}]},
 PlotRange -> {{-6, 10}, {-4, 6}}, ImageSize -> {400, 300}]

Mathematica graphics

share|improve this answer
    
Thanks: GraphicsGrid caused my problem. I used GraphicsGrid because I have plots to include below the graphic. Can you make suggestions? –  Stephen Nov 29 '13 at 19:37
    
@Stephen See edit, please –  belisarius Nov 29 '13 at 19:40
    
Good idea. I am overwhelmed with all the graphics options and their constraints. Thanks so much –  Stephen Nov 29 '13 at 20:00
    
@Stephen Yes, it's the price for flexibility. There are too many different parameters and options, and it requires some practice to get through it. –  belisarius Nov 29 '13 at 20:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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