RegionPlot seems to be for plotting regions with an embedding dimensions of 2 only, and RegionPlot3D for regions with an embedding dimensions of 3.

Yet passing a region of the wrong embedding dimension to them might do a number of different thing (which is never an error message complaining about the dimension).

Often they just give an nnregion error:

reg1 = ImplicitRegion[x^4 + y^4 + z^4 < 1, {x, y, z}]; (* note 3D region *)

RegionPlot[reg1] (* used with 2D plotting function *)

During evaluation of RegionPlot::nnregion: ImplicitRegion[x^4+y^4+z^4<1,{x,y,z}] cannot be automatically discretized. >>

During evaluation of RegionPlot::invplotreg: {ImplicitRegion[x^4+y^4+z^4<1,{x,y,z}]} is not a valid region to plot. >>

(* RegionPlot[reg1] *)

(Of course RegionPlot3D[reg1] works.)

But look:

RegionPlot[Ball[]] (* my understanding was that Ball[] is a 3D region equivalent to Ball[{0,0,0}] *)

Mathematica graphics

Even though:

(* 3 *)

RegionPlot[Ball[{0, 0, 0}] does the same thing.

This works as expected:

RegionPlot[Ball[{0, 0}]]

Mathematica graphics

(Although weirdly the BoundaryStyle option of RegionPlot is not respected, perhaps a bug?)

RegionPlot3D will also issue an nnregion message usually, but not always:

RegionPlot3D@InfiniteLine[{{0, 0}, {1, 1}}]

Mathematica graphics

Once again the embedding dimension didn't match, but the function just produced an empty plot instead.


  • Are these all bugs or do some of the results (e.g. RegionPlot[Ball[]]) make sense?

  • Why don't the functions just check the RegionEmbeddingDimensions and let the user know what's wrong? Is there any technical limitation to this (such as excessive computation time in edge cases)?

  • $\begingroup$ Yes, I think there is room for improvement here, and I've seen similar bug reports from @rcollyer a while ago. It's not utterly unreasonable to give up on plotting with a message (even if not the best one) when the available methods fail. For 3D graphics primitives, it looks like RegionPlot will try to plot the part in the $xy-$plane, e.g. RegionPlot[Simplex[3]] (except the boundary curve isn't shown...), and for Ball[] I would have expected the cross-section to have a filled interior... Perhaps some day RegionPlot and RegionPlot3D will get officially documented for region input. $\endgroup$ – ilian Jul 19 '15 at 15:33
  • 1
    $\begingroup$ @ilian I never realized that RegionPlot wasn't documented for region input. Many of the region types are illustrated through RegionPlot in the documentation. $\endgroup$ – Szabolcs Jul 19 '15 at 15:54
  • $\begingroup$ Right, I meant on ref/RegionPlot and not through ad hoc use. $\endgroup$ – ilian Jul 19 '15 at 15:59

Your Answer

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

Browse other questions tagged or ask your own question.