MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to combine Dynamic graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105541] Re: How to combine Dynamic graphics
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Tue, 8 Dec 2009 06:43:08 -0500 (EST)

From: "John Fultz" <jfultz at wolfram.com>


"Show doesn't know how to deal with something that has the head Dynamic."....

Let me give a counter-example. In what follows I show a piece of code from one of my presentations, and I am much too lazy 
to shorten it for the purposes of demonstrating within this discussion. Please excuse me. Anyway, it contains several definitions 
of equations to be drawn that are irrelevant for the present discussion. However, in the 
code part that is entitled "MainPart" you will find the Show statement wrapped around Dynamic (and also the 
DynamicModule wrapped around Show). Everything functions as desired. Please have a look:


g1[x_] := If[x <= 0, (3*x^2)/16, 0];
g2[x_] := If[x <= 0, x^2/4, 0];
g3[x_] := 0;
eta2[t_, b_] := If[t - 1 > 0, 0, 2.*Sqrt[-(t - 1)/(b + 0.01)]];
eta1[t_, b_] := 
  If[t - 1 >= (3*b^2)/16, 0, 
   0.7*(Sqrt[3*Abs[b]]/2 + Sqrt[-(t - 1) + b^2/4])];
eta[t_, b_] := If[b >= 0, eta2[t, b], eta1[t, b]];

point[a_, b_] := Disk[{b, a}, 0.1];
pl = Plot[{Tooltip[g1[x], "f(\[Eta]\[NotEqual]0)=f(\[Eta]=0)"], 
    Tooltip[g2[x], 
     "(\!\(\*SuperscriptBox[\"d\", \"2\"]\)f/\!\(\*SuperscriptBox[\"d\
\[Eta]\", \"2\"]\)\!\(\*SubscriptBox[\")\", 
RowBox[{\"\[Eta]\", \"\[NotEqual]\", \"0\"}]]\)=0"], 
    Tooltip[g3[x], 
     "(\!\(\*SuperscriptBox[\"d\", \"2\"]\)f/\!\(\*SuperscriptBox[\"d\
\[Eta]\", \"2\"]\)\!\(\*SubscriptBox[\")\", 
RowBox[{\"\[Eta]\", \"=\", \"0\"}]]\)=0"]}, {x, -4, 2}, 
   PlotRange -> {{-4, 2}, {-2, 3}}, PlotStyle -> Thick, Axes -> True, 
   Ticks -> None, AxesLabel -> {\[Beta], \[Alpha]}, 
   LabelStyle -> Directive[Large], ImageSize -> 350, 
   Epilog -> {Inset[
      Text[Style["\[Eta]=0", FontSize -> 20]], {1.5, 2.5}], 
     Inset[Text[
       Style["\[Eta]\[NotEqual]0", FontSize -> 20]], {-1, -1.5}] }, 
   Filling -> {2 -> {3}}, 
   PlotLabel -> Style["Phase Diagram", 20, Red, Bold]];



MainPart = 
 DynamicModule[{pt = {1.7, 2}}, 
  GraphicsColumn[{Show[{pl, Graphics[Locator[Dynamic[pt]]]}, 
     ImageSize -> 500], 
    GraphicsRow[{Dynamic[
       Plot[pt[[2]] x^2/2 + pt[[1]] x^4/4 + x^6/6, {x, -3, 3}, 
        PlotRange -> {{-4, 4}, {-2, 3}}, Axes -> True, Ticks -> None, 
        AxesLabel -> {Style[\[Eta], Large, Plain, 
           FontFamily -> "Symbol"], 
          Style["f", Large, Italic, FontFamily -> "Times New Roman"]},
         PlotStyle -> {Thick, Blue}, LabelStyle -> Directive[Large], 
        PlotLabel -> Style["Landau Potential", 20, Red, Bold] (*,
        ImageSize->400*)]], 
      Dynamic[Plot[
        Tooltip[eta[t, pt[[1]]], "\!\(\*SqrtBox[FractionBox[
RowBox[{
RowBox[{\"-\", \"\[Beta]\"}], \"+\", SqrtBox[
RowBox[{SuperscriptBox[\"\[Beta]\", \"2\"], \"-\", 
RowBox[{\"4\", \"\[Alpha]\[Gamma]\"}]}]]}], 
RowBox[{\"2\", \"\[Gamma]\"}]]]\)"], {t, pt[[2]] + 1, 3.2}, 
        PlotRange -> {{0, 3}, {0, 2.5}},(*ImageSize->400,*) 
        PlotStyle -> {Thick, Blue}, Ticks -> None, Axes -> True, 
        AxesLabel -> {T, \[Eta]}, 
        PlotLabel -> Style["Order Parameter", 20, Red, Bold], 
        LabelStyle -> Directive[Large]]]}, ImageSize -> 700, 
     Spacings -> 70]}, Spacings -> -350]]


Regards, Alexei


-- 
Alexei Boulbitch, Dr., habil.
Senior Scientist

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg

Phone: +352 2454 2566
Fax:   +352 2454 3566

Website: www.iee.lu

This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.




  • Prev by Date: Re: Rectangle and Circle
  • Next by Date: Re: variable number of controls in manipulate
  • Previous by thread: Re: multiplication of large multivariate polynomials
  • Next by thread: Re: Re: How to combine Dynamic graphics