8
$\begingroup$

How can I eliminate (remove) the unwanted vertical line x = 1 when I make the plot shown below.

p3 = 
  Plot[
    {0.5/(-0.1 x + 0.1), 
     0.04/(-0.004 x + 0.004), 
     1.359/(-0.08 x + 0.08), 
     Abs[0.5/(-0.1 x + 0.1)], 
     Abs[0.04/(-0.004 x + 0.004)], 
     Abs[1.359/(-0.08 x + 0.08)]}, 
    {x, 0, 2}, 
    PlotRange -> {{0, 2}, {0, 100}}]

enter image description here

$\endgroup$
  • $\begingroup$ I don't see any green line in V11.1.1 $\endgroup$ – Kuba Jun 16 '17 at 12:56
  • 3
    $\begingroup$ Look up Exclusions and/or search for same on this site. $\endgroup$ – Jack LaVigne Jun 16 '17 at 13:00
  • 3
    $\begingroup$ With Version 10 use Exclusions -> {x == 1} $\endgroup$ – eldo Jun 16 '17 at 13:06
  • 2
    $\begingroup$ Exclusions -> 1 should do the trick. $\endgroup$ – Jack LaVigne Jun 16 '17 at 13:07
  • 2
    $\begingroup$ Before above users comments, I myself separated the one line for plot into two lines one with PlotRange from [0,0.9] other one with [1.1,2] after that used Show. But this trick is not as good as above suggested tricks by professional Mathematica developers $\endgroup$ – Unbelievable Jun 16 '17 at 13:11
2
$\begingroup$

I can duplicate your problem with V10.4.0 but not with V11.1.1, so I think this is a bug that has been corrected.

Plot[
  {0.5/(-0.1 x + 0.1), 
   0.04/(-0.004 x + 0.004),
   1.359/(-0.08 x + 0.08), 
   Abs[0.5/(-0.1 x + 0.1)], 
   Abs[0.04/(-0.004 x + 0.004)], 
   Abs[1.359/(-0.08 x + 0.08)]}, 
  {x, 0, 2}, 
  PlotLegends -> "Expressions",
  PlotRange -> {{0, 2}, {0, 100}}]

Gives

ver10.4

with V10.4.0 and

ver11.1

with V11.1.1

| improve this answer | |
$\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.