1
$\begingroup$

I have the following figure

enter image description here

Given by the Following code

pic3 := Plot[0.7 + 0*x, {x, -0.5, 1}]
pic4 := ListLinePlot[
  Thread[List[0.8 & /@ Range[0, 1], Range[-0.2, 1]]]]

pic5 := Graphics[Line[{{0, 0}, {0, 1}, {1, 0}, {0, 0}}]]
Show[pic5, pic4, pic3, PlotRange -> {{-1, 1}, {-1, 1}}]

I would like to add 2 brackets one that said $\alpha$ between $(0,0)$ and the cut in $y$-axis and another that said $\beta$ between $(0,0)$ and the cut at the $x-$Axis. Is this possible ? Thanks in advance .

$\endgroup$

2 Answers 2

3
$\begingroup$
{a, b} = MapThread[Graphics[{#, Disk[], White, 
      Inset[Style[#2, FontSize -> Scaled[.5]]]}, ImageSize -> 40] &, 
   {{Blue, Red}, {"α", "β"}}];

Deploy @ DynamicModule[{pt1 = {0., .8}, pt2 = {.8, 0}},
  Graphics[{EdgeForm[Black], FaceForm[], Triangle[], 
    FaceForm[Opacity[1]],
    Locator[Dynamic[pt1, (pt1 = {#[[1]], .8}) &], a],
    Locator[Dynamic[pt2, (pt2 = {.8, #[[2]]}) &], b]},
   PlotRangePadding -> .2,  
   GridLines -> {{.8}, {.8}}, 
   GridLinesStyle -> Directive[Thick, ColorData[97]@1]]]

enter image description here

$\endgroup$
5
$\begingroup$

For a different approach, beginning with version 12 you can use the EXPERIMENTAL function GeometricScene

Clear["Global`*"]

Show[
 GeometricScene[
   {"O" -> {0, 0},
    a -> {0, 1}, b -> {1, 0},
    α -> {0, 0.7}, β -> {0.8, 0},
    α2 -> {1.5, 0.7}, (* 
    chosen outside the plot range *)
    β2 -> {0.8, 1.5}},(* 
   chosen outside the plot range *)
   {Triangle[{a, b, "O"}],
    InfiniteLine[{α, α2}],
    InfiniteLine[{β, β2}]}]
  ["Graphics"],
 PlotRange -> {{-0.5, 1.1}, {-0.2, 1.1}}]

enter image description here

Or for a dynamic scene

Manipulate[
 Show[
  GeometricScene[
    {"O" -> {0, 0},
     a -> {0, 1}, b -> {1, 0},
     "α" -> {0, α}, "β" -> {β, 0},
     α2 -> {1.5, α}, (* 
     chosen outside the plot range *)
     β2 -> {β, 1.5}},(* 
    chosen outside the plot range *)
    {Triangle[{a, b, "O"}],
     InfiniteLine[{"α", α2}],
     InfiniteLine[{"β", β2}]}]
   ["Graphics"],
  PlotRange -> {{-0.5, 1.1}, {-0.2, 1.1}}],
 {{α, 0.7}, 0, 1, 0.025, Appearance -> "Labeled"},
 {{β, 0.8}, 0, 1, 0.025, Appearance -> "Labeled"}]

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.