2
$\begingroup$

I want to modify the range of the axes. The axes should only show the range from 0 to 1. The plot contains a text item (name of HalfLine) witch disappears when I add PlotRange, but if I don't add PlotRange, the axes reach into the negativ area. The following Code and picture should be modified

Code

Plot[{3 x (1 - x), x}, {x, 0, 1},
 PlotStyle -> {{Black, Thick}},
 Ticks -> {{0, 0.5, 1}, {0, 0.5, 1}},
 LabelStyle -> {FontSize -> 30, FontFamily -> "Times" , Black, Bold},
 ImageSize -> Full,
 Epilog -> {{Black,Text[Style["\!\(\*SuperscriptBox[\(x\), \(\"\<*\>\"\)]\)",
Bold, 20], {2/3, -0.04}], FontSize -> 30,
Line[{{0, 1}, {1, 1}}], Line[{{1, 1}, {1, 0}}]}, 
{Black, Dashed, Line[{{2/3, 0}, {2/3, 1}}]}}]

The Plot Plot with text "x^*"

If I add PlotRange to the code the name of the HalfLine disappears

Changed Code

Plot[{3 x (1 - x), x}, {x, 0, 1},
 PlotStyle -> {{Black, Thick}},
 Ticks -> {{0, 0.5, 1}, {0, 0.5, 1}},
 LabelStyle -> {FontSize -> 30, FontFamily -> "Times" , Black, Bold},
 PlotRange -> {{0, 1}, {0, 1}},
 ImageSize -> Full,
 Epilog -> {{Black, 
    Text[
     Style["\!\(\*SuperscriptBox[\(x\), \(\"\<*\>\"\)]\)", Bold, 
      20], {2/3, -0.04}], FontSize -> 30, Line[{{0, 1}, {1, 1}}], 
    Line[{{1, 1}, {1, 0}}]}, {Black, Dashed,  
    Line[{{2/3, 0}, {2/3, 1}}]}}
 ]

Plot without Text item

I also tried AxedEdge but this isn't a option for plot. I even tried this:

p = Plot[{3 x (1 - x), x}, {x, 0, 1},
  PlotStyle -> {{Black, Thick}},
  Ticks -> {{0, 0.5, 1}, {0, 0.5, 1}},
  AxesLabel -> {"x", 
    "\!\(\*TemplateBox[{\"f\", \"\\\"r\\\"\"},\n\
\"IndexedDefault\"]\)(x)"},
  
  AxesStyle -> Thick,
  LabelStyle -> {FontSize -> 30, FontFamily -> "Times" , Black, 
    Bold},
  
  ImageSize -> Full,
  PlotRange -> {{0, 1}, {0, 1}},
  Epilog -> {{Black, Line[{{0, 1}, {1, 1}}], 
     Line[{{1, 1}, {1, 0}}]}, {Black, Dashed,  
     Line[{{2/3, 0}, {2/3, 1}}]}} ]

Show[p, Epilog -> {Text[
    Style["\!\(\*SuperscriptBox[\(x\), \(\"\<*\>\"\)]\)", Bold, 
     20], {2/3, -0.04}], FontSize -> 30} ]

But it didn't work.

$\endgroup$
0

1 Answer 1

3
$\begingroup$

With a few modifications especially using Frame:

Plot[{3 x (1 - x), x}
  , {x, 0, 1}
 , Frame -> True
  , PlotStyle -> {{Black, Thick}}
 , FrameTicks -> {
   {Range[0, 1.0, 0.5], {None}}
   , {Range[0, 1.0, 0.5]~
     Join~{{2/3, 
       Style["\!\(\*SuperscriptBox[\(x\), \(\"\<*\>\"\)]\)", Bold, 
        20]}}, {None}}
   }
  , PlotRange -> {{0, 1}, {0, 1}}
 , ImagePadding -> {{60, 20}, {60, 20}}
  , LabelStyle -> {FontSize -> 30, FontFamily -> "Times", Black, Bold}
  , ImageSize -> 600
 , Epilog -> {
      {Black
    (*, Text[Style["\!\(\*SuperscriptBox[\(x\), \(\"\<*\>\"\)]\)", 
    Bold, 20], {2/3,-0.04}]*)
    , FontSize -> 30
    (*, Line[{{0, 1}, {1, 1}}]
    , Line[{{1, 1}, {1, 0}}]*)
    }
   , {Black, Dashed, Line[{{2/3, 0}, {2/3, 1}}]}
      }
  ]

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.