0
$\begingroup$

How would one restrict the domain on a ParametricPlot? For example, I have the following plot:

ClearAll["Global`*"]; xi = 2; k0 = 9; \[Sigma] = 2; 
Show[Table[sol = NDSolve[{D[xtraj[t], t] == 
   -(Sinh[2 xtraj[t]/(Cosh2 xtraj[t])), xtraj[0] == n}, xtraj[t], {t, 0, 4}]; 
ParametricPlot[{xtraj[t], t} /. sol, {t, 0, 4}, 
 PlotRange -> All, PlotStyle -> {Blue, Full, Medium}, 
 AxesStyle -> Thickness[.003], 
 LabelStyle -> {Black, Medium}, 
 AxesLabel -> {xtraj, t}], {n, -4, 4 - 0.09, 0.09}]]

How can I exclude -0.1 > xtraj[t] > 0.1?

I simply can restrict the range but not the domain?

$\endgroup$
  • $\begingroup$ I thought using a well-known name I may get an answer - changed it to my name now. $\endgroup$ – Betty May 28 '18 at 5:21
  • $\begingroup$ does this give what you need: ParametricPlot[ Evaluate[ConditionalExpression[{xtraj[t], t}, Not[-.1 <= xtraj[t] <= .1]] /. sol[[1]]], {t, 0, 4}, ...]? $\endgroup$ – kglr May 28 '18 at 5:26
  • $\begingroup$ .. or ParametricPlot[Evaluate[{xtraj[t], t} /. sol[[1]]], {t, 0, 4}, RegionFunction -> (Not[-.1 <= # <= .2] &), ...]? $\endgroup$ – kglr May 28 '18 at 5:30
  • $\begingroup$ No it does not :-( $\endgroup$ – Betty May 28 '18 at 5:43
  • $\begingroup$ Using the following works: RegionFunction -> (Not[-.1 <= #1 <= .2] &) $\endgroup$ – Betty May 28 '18 at 6:24
1
$\begingroup$

Add the option

RegionFunction -> (Not[-.1 <= # <= .2] &)

to your ParametricPlot.

$\endgroup$
  • $\begingroup$ Thanks that works. $\endgroup$ – Betty May 28 '18 at 8:00
  • $\begingroup$ @Betty, my pleasure. Welcome to mma.se. $\endgroup$ – kglr May 28 '18 at 8:01

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.