3
$\begingroup$

Consider this plot

RegionPlot[{n + k > 6}, {n, 0, 4}, {k, 0, 15}, BoundaryStyle -> None]

I want to add a label on the boundary like in the picture. How can I do that?

enter image description here

$\endgroup$
3
$\begingroup$
nmax = 4; kmax = 15;
RegionPlot[{n + k > 6}, {n, 0, nmax}, {k, 0, kmax}, BoundaryStyle -> None,
  Epilog -> Text[Style["label here", 16, Bold], {1, 5.5}, Left, {kmax, - nmax}]]

enter image description here

$\endgroup$
  • $\begingroup$ What Mathematica version and OS are you using? With v11.3 on my Mac the label isn't displayed. $\endgroup$ – Bob Hanlon Jan 24 at 14:49
  • $\begingroup$ @BobHanlon, I am using version 11.3 (windows 10/64). $\endgroup$ – kglr Jan 24 at 17:18
  • $\begingroup$ @kglr with version 11.2 the label is not displayed $\endgroup$ – apt45 Jan 27 at 15:27
5
$\begingroup$

Here's how:

p1 = RegionPlot[{n + k > 6}, {n, 0, 4}, {k, 0, 15}, BoundaryStyle->None];
p2 = Rotate[Graphics[Text[Style["label here", FontSize->20,Background-> Transparent, Black, Bold],Scaled[{1/4, 6.5/15}]]], -ArcTan[4/15]];
Overlay[{p1, p2}]

enter image description here

$\endgroup$

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.