1
$\begingroup$

I am new to Mathematica and I would like to plot a number of circles all onto the same graph. I would like to visually observe which circles intersect each other. One constraint on all the circles is that the x-coordinate is always zero.

I have a list of 3-tuples (x-coordinate, y-coordinate, radius) which represent each circle. For example, (0,0,1), (0,1,5)... I am not sure how construct the circle intersections using the Plot command.

$\endgroup$
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Apr 3 '15 at 16:18
4
$\begingroup$
triples = Table[{0, RandomInteger[5], RandomReal[]}, {5}];
(* {{0,4,0.676806},{0,5,0.377882},{0,2,0.421773},{0,4,0.631164},{0,3, 0.820832}} *)

opts = {Axes -> True, PlotRange -> {{-1, 1}, {0, 6}}, Frame -> False, 
      ImageSize -> 150, AspectRatio -> Automatic, BaseStyle -> Thick};

Graphics

g1 = Graphics[{Hue[RandomReal[]], Circle[{#, #2}, #3]} & @@@ triples, opts];

Graphics / Translate / Scale

g2 = Graphics[{Hue[RandomReal[]], Translate[Scale[Circle[], #3], {#, #2}]}&@@@ triples,
  opts]

ContourPlot

g3 = ContourPlot[Evaluate[(x - #)^2 + (y - #2)^2 == #3^2 & @@@ triples], 
   {x, -1, 1}, {y, 0, 6}, Evaluate[opts], ContourStyle->Table[Hue[RandomReal[]], {5}]];

ParametricPlot

g4 = ParametricPlot[Evaluate[(#3 { Cos[t], Sin[t]} + {#, #2}) & @@@ triples], 
 {t, 0, 2 Pi}, Evaluate[opts], PlotStyle->Table[Hue[RandomReal[]], {5}]];

Row[Labeled[##, Top] & @@@ {{g1, "Graphics"}, {g2, "Graphics/ Translate/ Scale"}, 
   {g3, "ContourPlot"}, {g4, "ParametricPlot"}}, Spacer[5]]

enter image description here

$\endgroup$
  • $\begingroup$ The colour coding is a great idea. $\endgroup$ – user27494 Apr 3 '15 at 16:36
  • $\begingroup$ @I.K., btw, if you have version 10, you can use RandomColor[] instead of Hue[RandomReal[]]. $\endgroup$ – kglr Apr 3 '15 at 16:49
  • $\begingroup$ Yes I do. Thanks for the tip. $\endgroup$ – user27494 Apr 3 '15 at 16:52
0
$\begingroup$
Graphics[
   Circle @@@ ({{#[[1]], #[[2]]}, #[[3]]} & /@ 
   {{0, 2, 3}, {0, 4, 6}, {0, 12, 9}})
         ]
$\endgroup$
  • $\begingroup$ I've corrected my post as I think it was misleading. Even though I have 3-tuples to represent each circle in my problem specification, I did not necessarily want to pass that exact structure into the plotting commands. Sorry to mislead but I did up vote your answer as it pointed me in the right direction as I thought I needed to use the Plot command to do this. $\endgroup$ – user27494 Apr 3 '15 at 16:39
0
$\begingroup$

Show[Graphics[{Circle[{0, 0}, 2], Circle[{1, 1}, 2]}], Axes -> True]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy