4
$\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$

2 Answers 2

4
$\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$
3
  • $\begingroup$ What Mathematica version and OS are you using? With v11.3 on my Mac the label isn't displayed. $\endgroup$
    – Bob Hanlon
    Commented Jan 24, 2019 at 14:49
  • $\begingroup$ @BobHanlon, I am using version 11.3 (windows 10/64). $\endgroup$
    – kglr
    Commented Jan 24, 2019 at 17:18
  • $\begingroup$ @kglr with version 11.2 the label is not displayed $\endgroup$
    – apt45
    Commented Jan 27, 2019 at 15:27
6
$\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 and acknowledge you have read our privacy policy.

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