0
$\begingroup$

I keep getting a light background behind my text when I use the PlotLabels option (see picture below).

graphics

DynamicModule[
    {Demand, Supply, G,  F, X1, Y1, Y2, e\`Graf, 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["Nu kan henholdsvis Consumer Surplus, Producer Surplus, og Social Welfare bestemmes:"],
    StringForm["CS = Subscript[\[Integral], 0]^Q^*(Demand)\[DifferentialD]Q - (P^* * Q^*) = Subscript[\[Integral], 0]^`2`(`1`)\[DifferentialD]Q - (`3` * `2`) = `4`",Demand,G1,F1,CS1],
    StringForm["PS = (P^* * Q^*) - Subscript[\[Integral], 0]^Q^*(Supply)\[DifferentialD]Q = (`1` * `2`) - Subscript[\[Integral], 0]^`2`(`3`)\[DifferentialD]Q = `4`",F1,G1,Supply,PS1],
    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}
    ]]

I am not able to fix it at all, so I hope that someone here are able to help me. Couldn't see any questions like this.

Also, the label bounding boxes are quiet big sometimes (comparred to the text plotted), and I cant see why this is the case (this also appears above (see the label "P*".

$\endgroup$
1
  • 1
    $\begingroup$ MadsM, welcome to mma.se. If the following one line captures the essence of your question, I suggest you replace the long code in your question with it: Show[Plot[60-x, {x, 0,60}, Filling->Axis],ListPlot[{Labeled[{10, 30}, "P^*"], Labeled[{30, 20}, "Q^*"] }, PlotStyle -> PointSize[Large]]] $\endgroup$
    – kglr
    Commented Jun 20, 2019 at 20:21

1 Answer 1

1
$\begingroup$

You can use Background -> None inside Placed, Labeled and Callout in V12.

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}, Background -> None]]), (Plot[{Supply, 
    Demand}, {Q, 0, G}, Filling -> 1 -> F, 
   PlotLabels -> Placed[{"PS"}, {X1, Y2}, Background -> None]]), 
 Plot[{Supply, Demand}, {Q, 0, 
   Slutx}], (ContourPlot[{Q == G}, {Q, 0, Slutinterval}, {y, 0, F}, 
   ContourStyle -> {Black, Dashed, 
     Thick}]), (ListPlot[{Labeled[{0, F}, "P^*", Background -> None], 
    Labeled[{G, 0}, "Q^*"], {G, F}}, PlotStyle -> PointSize[Large]])]
$\endgroup$
3
  • $\begingroup$ Hi! Thanks this works! however the field placed with text is much bigger than the text itself. Can you help me fix this? $\endgroup$
    – MadsM
    Commented Jun 21, 2019 at 5:15
  • $\begingroup$ Which version of Mathematica are you using? $\endgroup$ Commented Jun 25, 2019 at 16:12
  • $\begingroup$ Is this feature documented anywhere? $\endgroup$
    – Szabolcs
    Commented Aug 31, 2020 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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