2
$\begingroup$

I have a "named" point in Mathematica 10 and am plotting it like this using RegionPlot:

  $PointStyle = Directive@{PointSize[1], Red};
distanceX = Sqrt[(x - 8000)^2 + y^2];
distanceY = Sqrt[x^2 + y^2];
rate1 = 45;
rate2 = 60;
point["camp location"] = Point[{8000, 0}];
curve["Circle of Apollonius"] = 
  ImplicitRegion[distanceX/distanceY == rate1/rate2, {x, y}];
Show[
 RegionPlot[{curve["Circle of Apollonius"], point["camp location"]}, 
  Method -> {"DiscretizationMethod" -> "Symbolic"}, 
  PlotRange -> {{0, 40000}, {-20000, 20000}}, 
  PlotStyle -> {$PointStyle}]]

Curve of Apollonius

As can be seen in the output the dot is kind of small. Unfortunately, the plot is not using my attempt to change the PointSize directive and plots the point as a small period-sized dot no matter what. How can I change the size of the dot?

I tried using a separate ListPlot inside of the Show, but in this case no dot appears at all:

    $PointStyle = Directive@{PointSize[Large], Red};
Show[{
   RegionPlot[{ curve["path to camp"] }, Method -> {"DiscretizationMethod" -> "Symbolic"}],
   ListPlot[{ point["camp location"]},  PlotStyle -> {$PointStyle}]}]
$\endgroup$
  • $\begingroup$ Plot the point with ListPlot and use Show to combine it with the RegionPlot. $\endgroup$ – paw Oct 1 '14 at 0:14
  • $\begingroup$ @paw I tried this (code above) but the dot disappeared completely. $\endgroup$ – Tyler Durden Oct 1 '14 at 0:35
  • $\begingroup$ Please post a full working example. $\endgroup$ – paw Oct 1 '14 at 0:37
  • $\begingroup$ @paw I have posted a full text example. $\endgroup$ – Tyler Durden Oct 1 '14 at 0:46
  • $\begingroup$ Use option BoundaryStyle -> Directive@{PointSize[Large], Red} $\endgroup$ – Junho Lee Oct 1 '14 at 1:08
3
$\begingroup$

One way to do this is to separate the RegionPlot from the point you are trying to plot, and instead render it separately:

distanceX = Sqrt[(x - 8000)^2 + y^2];
distanceY = Sqrt[x^2 + y^2];
rate1 = 45;
rate2 = 60;
point["camp location"] = Point[{8000, 0}];
curve["Circle of Apollonius"] = 
  ImplicitRegion[distanceX/distanceY == rate1/rate2, {x, y}];
Show[RegionPlot[{curve["Circle of Apollonius"]}, 
  Method -> {"DiscretizationMethod" -> "Symbolic"}, 
  PlotRange -> {{0, 40000}, {-20000, 20000}}], 
 Graphics[{PointSize[Large], Red, point["camp location"]}]]

which produces

enter image description here

Points can always be plotted separately by rendering them with Graphics[{BunchOfDirectives, Point[...]}], so that you don't need to worry about figuring out how to tell RegionPlot that you want one particular point to have a certain set of directives.

By the way, if you use PointSize[1] like your original code seems to attempt, instead of PointSize[Large], you get this horror:

enter image description here

Additional clarification

Jens pointed out in his comment that there is a fundamental difference in how Mathematica displays Point in your original code, and how my version displays it: when you include the Point inside RegionPlot, Mathematica interprets it as a region object which is to be displayed.

For example, replacing point["camp location"] in your original code with Disk[{20000, 0}, 4000] generates this:

enter image description here

It doesn't look very Disk-shaped, does it? That's because it's plotting it as a discretized region of a Disk, rather than as a Disk graphics object.

In contrast, watch what happens when the Disk is moved outside of the RegionPlot and rendered separately:

Show[RegionPlot[{curve["Circle of Apollonius"]}, 
  Method -> {"DiscretizationMethod" -> "Symbolic"}, 
  PlotRange -> {{0, 40000}, {-20000, 20000}}], 
 Graphics[{Red, Disk[{20000, 0}, 4000]}]]

enter image description here

Here Disk is rendered as a Disk graphics, and actually looks round.

$\endgroup$
  • $\begingroup$ (+1) Maybe you can include a comment regarding the difference between Point in a RegionPlot and in Graphics: the ability to include Point in RegionPlot as done in the question is due to the fact that Point can be interpreted as a "region" just like e.g. a Disk can. But in that interpretation (which depends entirely on the context being RegionPlot), it's impossible to use styling the way one expects it to work for the Graphics primitive Point. These are basically two different incarnations of Point, and the styling only works when removing it as a RegionPlot argument. $\endgroup$ – Jens Oct 1 '14 at 5:15
  • $\begingroup$ @Jens: Thanks for the info, I didn't know that! I added a couple examples which highlight the difference between the two graphics interpretations. $\endgroup$ – DumpsterDoofus Oct 1 '14 at 14:34
3
$\begingroup$

You can use option Epilog

$PointStyle = Directive@{PointSize[Large], Red};
distanceX = Sqrt[(x - 8000)^2 + y^2];
distanceY = Sqrt[x^2 + y^2];
rate1 = 45;
rate2 = 60;
point["camp location"] =
  Point[{8000, 0}];
curve["Circle of Apollonius"] = 
  ImplicitRegion[distanceX/distanceY == rate1/rate2, {x, y}];
RegionPlot[{curve["Circle of Apollonius"]}, 
 Method -> {"DiscretizationMethod" -> "Symbolic"}, 
 PlotRange -> {{0, 40000}, {-20000, 20000}},
 Epilog -> {$PointStyle, point["camp location"]}]
$\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.