I want to label the curves in Plot[] with their equations (eg. "y = x^2") not just their expressions (eg. x^2). There has to be a way to do this, but I cannot figure it out.

shadeBoundedRegion[top_, bottom_, a_, b_]:= Plot[{Max[top, bottom], top, bottom}, {x,a,b}, Filling -> {3 -> {1}}, PlotLabels->{"" ,Above,Above}];

I apologize if this has been answered elsewhere, but I could not find it.


Use PlotLabels -> {"", HoldForm[y = top], HoldForm[y = bottom]} in the definition of shadeBoundedRegion:

shadeBoundedRegion[top_, bottom_, a_, b_] :=  Plot[{Max[top, bottom], top, bottom}, 
 {x, a, b}, 
 Filling -> {3 -> {1}}, 
 PlotLabels -> {"", HoldForm[y = top], HoldForm[y = bottom]}];

shadeBoundedRegion[4, x^2, -3, 3]

enter image description here


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.