3
$\begingroup$

I dont want the lines not to go beyond the inside of the shown circle but i dont really know how to do it.

PlotRange -> {{-1, 1}, {-1, 1}} only sets a rectangular area.

enter image description here

Plot[{{1.2 (-1 + x), -0.9 - 0.5 (-0.18 + x), -0.35 + 2.8 (0.9 x)}, 
  Sqrt[(1 - x^2)],  -Sqrt[(1 - x^2)]}, {x, -1, 1}, 
 PlotStyle -> {Blue},  PlotRange -> {{-1, 1}, {-1, 1}}, 
 ImageSize -> Large] 
$\endgroup$
  • $\begingroup$ Also related to RegionFunction: (32219) and (50767) $\endgroup$ – MarcoB Jun 3 '15 at 16:10
4
$\begingroup$

Use the option RegionFunction:

Plot[{{1.2 (-1 + x), -0.9 - 0.5 (-0.18 + x), -0.35 + 2.8 (0.9 x)}, 
  Sqrt[(1 - x^2)], -Sqrt[(1 - x^2)]}, {x, -1, 1}, PlotStyle -> {Blue},
  PlotRange -> {{-1, 1}, {-1, 1}}, ImageSize -> Large, 
 RegionFunction -> Function[{x, y}, -Sqrt[(1 - x^2)] <= y <= Sqrt[(1 - x^2)]]]

Mathematica graphics

Or use ConditionalExpression to restrict the first three functions to the appropriate region:

Plot[{ConditionalExpression[1.2 (-1 + x), 
      -Sqrt[(1 - x^2)] <= 1.2 (-1 + x) <= Sqrt[(1 - x^2)]],
   ConditionalExpression[-0.9 - 0.5 (-0.18 + x), 
    -Sqrt[(1 - x^2)] <= -0.9 - 0.5 (-0.18 + x) <=  Sqrt[(1 - x^2)]], 
   ConditionalExpression[-0.35 + 2.8 (0.9 x), 
    -Sqrt[(1 - x^2)] <= -0.35 + 2.8 (0.9 x) <=  Sqrt[(1 - x^2)]],
   Sqrt[(1 - x^2)], -Sqrt[(1 - x^2)]}, {x, -1, 1}, 
 PlotStyle -> {Blue}, PlotRange -> {{-1, 1}, {-1, 1}}, 
 ImageSize -> Large]
(* same picture *)
$\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.