Suppose I have functions f[x] and g[x] which are defined in the region 0 ≤ x ≤ 1 and 2 ≤ x ≤ 3. If I want to plot either f or g separately, I can do the following:

Plot[f[x], {x, 0, 3}, RegionFunction -> (! 1 < # < 2 &)]

However, if I now wish to make a ParametricPlot of {f[x], g[x]} then the above RegionFunction no longer works. The reason being that the RegionFunction not operates on the (f,g)-plane, and not on the parameter x. Moreover, Exclusions also seems to only work on isolated values of x and not a range.

Is there a way to achieve this in a single call to ParametricPlot? (I could do one ParametricPlot per connected region in the parameter range, then combine the graphics, but this is a bit of a pain)


Use #3 instead of #. See the RegionFunction -> docs, "Details" section-

f[x_] := Sin@ x
g[x_] := x^2;
ParametricPlot[{g@x, f@x}, {x, 0, 3}, RegionFunction -> (! 1 < #3 < 2 &), AspectRatio -> 1]

Mathematica graphics

| improve this answer | |
  • $\begingroup$ Perfect! Thanks and apologies for my oversight in looking through the docs. $\endgroup$ – Saran Nov 20 '14 at 0:00

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.