3
$\begingroup$

How do I plot something like $$\{(x,y): 1 \leq x^2 + y^2 < 9\}?$$

I want to be able to make the boundary $x^2 + y^2 = 9$ dotted line and the unit circle filled and coloured region in between? I tried using

RegionPlot[1 <= x^2 + y^2 < 9, {x, -3.5, 3.5}, {y, -3.5, 3.5}, 
  Frame -> False, AxesOrigin -> {0, 0}, Axes -> True]

But that gave me a bolded boundary on $x^2 + y^2 = 9$

$\endgroup$

1 Answer 1

9
$\begingroup$

All you're missing is the option for BoundaryStyle

RegionPlot[1 <= x^2 + y^2 < 9, {x, -3.5, 3.5}, {y, -3.5, 3.5}, 
 Frame -> False, AxesOrigin -> {0, 0}, Axes -> True, 
 BoundaryStyle -> {Dotted, Thickness[0.005]}]

enter image description here

If you want the unit circle filled, you can RegionPlot that separately:

Show[RegionPlot[1 <= x^2 + y^2 < 9, {x, -3.5, 3.5}, {y, -3.5, 3.5}, 
  Frame -> False, AxesOrigin -> {0, 0}, Axes -> True, 
  BoundaryStyle -> {Dotted, Thickness[0.005]}], 
 RegionPlot[x^2 + y^2 < 1, {x, -3.5, 3.5}, {y, -3.5, 3.5}, 
  PlotStyle -> Red, BoundaryStyle -> {Dotted, Thickness[0.005]}]]

You can find all these (and more) in the help for RegionPlot.

$\endgroup$
4
  • $\begingroup$ Your second code gives me a red filled unit circle. $\endgroup$
    – Lemon
    Jan 24, 2014 at 2:40
  • $\begingroup$ Nvm I got it fixed. thanks $\endgroup$
    – Lemon
    Jan 24, 2014 at 2:47
  • $\begingroup$ You did say "and the unit circle filled" so I filled the unit circle with Red... or not... $\endgroup$
    – bill s
    Jan 24, 2014 at 3:26
  • $\begingroup$ No that would be the unit disk. $\endgroup$
    – Lemon
    Jan 25, 2014 at 2:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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