0
$\begingroup$

When i plot labels on a graph, then the text "field" is much bigger than the text itself. It gives some problems for me regarding placing the labels properly. Can someone help me fix this? see code and picture below for an example.

DynamicModule[
    {Demand, Supply, G,  F, X1, Y1, Y2, Slutinterval, CS, PS, SS, 
     Slutx, Sluty, G1, F1, X11, Y11, Y22, Graf1, Slutinterval1, 
     CS1, PS1, SS1, Slutx1, Sluty1},  
  Manipulate[
    G=Q/.Solve[Supply==Demand,Q][[1]];
    F=Block[{Q=G},Supply];
    CS=N[Integrate[Demand,{Q,0,G}]-(F*G)];
    PS=N[(F*G)-Integrate[Supply,{Q,0,G}]];
    SS=CS+PS;
    X1:=G/6;
    Y1:=((Block[{Q=0},Demand])-F)/2;
    Y2:=F-((F-(Block[{Q=0},Supply]))/2);
    Slutinterval:=G+G/100*30;
    Slutx=Q/.Solve[Demand==0,Q][[1]];
    Sluty=Block[{Q=0},Demand];

    G1=Quiet[NumberForm[AccountingForm[N[Q/.Solve[Supply==Demand,Q][[1]]]],{\[Infinity],2}]];
    F1=Quiet[NumberForm[AccountingForm[N[Block[{Q=G},Supply]]],{\[Infinity],2}]];
    CS1=Quiet[NumberForm[AccountingForm[N[Integrate[Demand,{Q,0,G}]-(F*G)]],{\[Infinity],2}]];
    PS1=Quiet[NumberForm[AccountingForm[N[(F*G)-Integrate[Supply,{Q,0,G}]]],{\[Infinity],2}]];
    SS1=Quiet[NumberForm[AccountingForm[N[CS+PS]],{\[Infinity],2}]];
    Column[{
    StringForm["Først bestemmes ligvægtsmængden og prisen. Dette gøres ved at finde Supply = Demand:"],
    StringForm["Supply = Demand \[DoubleLongRightArrow] Solve[`1` == `2`,Q] = `3`",Supply,Demand,G1],
    StringForm["Q^* = ``",G1],
    StringForm["På samme vis bestemmes den tihørende optimale pris:"],
    StringForm["P^* = Supply(``) = ``",G1,F1],
    StringForm["SS = CS + PS = `1` + `2` = `3`",CS1,PS1,SS1],
    Show[(Plot[{Supply,Demand},{Q,0,Slutinterval},
    AxesLabel->{"Q","P"},
    ImageSize->700,
    PlotRange->{{0,Slutx},{0,Sluty}},
    PlotLabels->{"Supply","Demand"," "}]),(Plot[{Supply,Demand,F},{Q,0,G},Filling->2-> F,PlotStyle-> {Orange,Blue,{Thick,Dashed,Black}},
    PlotLabels->Placed[{"CS"},{X1,Y1}]]),(Plot[{Supply,Demand},{Q,0,G},Filling->1-> F,
    PlotLabels->Placed[{"PS"},{X1,Y2}]]),Plot[{Supply,Demand},{Q,0,Slutx}],(ContourPlot[{Q==G},{Q,0,Slutinterval},{y,0,F},ContourStyle-> {Black,Dashed,Thick}]),(ListPlot[{Labeled[{0,F},"P^*"],Labeled[{G,0},"Q^*"],{G,F}},PlotStyle->PointSize[Large]])]},Spacings->1.5],
    Style["Velfærdsteori ved markedsligevægt (FK)",20,Bold],
    Style["Denne funktion beregner ligevægtspris og mængde på et marked under fuldkommen konkurrence. Ydermere beregner og skitserer",12,Plain],
    Style["funktionen Consumer Surplus, Producer Surplus samt Social Surplus. Man skal kende til efterspørgslen og udbuddet på markedet (Demand og Supply).",12,Plain],
    Control@{{Demand,-Q+98},InputField,ImageSize->Full},
    Control@{{Supply,0.5Q+2},InputField,ImageSize->Full},
    TrackedSymbols:>{Demand,Supply}
    ]]

Picture:

Plot

$\endgroup$
  • 1
    $\begingroup$ You have not defined F and G. Please post all the information we need to reproduce your problem. $\endgroup$ – C. E. Jun 21 at 6:09
  • $\begingroup$ I've added the rest of the code now $\endgroup$ – MadsM Jun 21 at 6:15
  • $\begingroup$ It doesn't run for me, there is some kind of error. By the way, we prefer minimal working solutions. If there is a smaller piece of code that illustrates the problem, then we'd prefer that. $\endgroup$ – C. E. Jun 21 at 6:22
  • $\begingroup$ Try now - the code was copied wrong. But the problem must appear in the "PlotLabels"-part i think $\endgroup$ – MadsM Jun 21 at 6:27
  • $\begingroup$ When I run the code, I don't get the same picture as you. The Q is further down and the boundary is not large like in the picture. I use Mathematica 12 on MacOS. $\endgroup$ – C. E. Jun 21 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.