1
$\begingroup$

I have shown some plots by using Show and Plot together. The problem is that an extra blue line is created in the output which I can not remove it. This is my code:

v = 2;
tr = -2;
ro = 2;    
both = Plot[{v x/(-4 tr)}, {x, -20, 0}, AxesOrigin -> {0, 0}, Filling -> ro tr - 1, FillingStyle -> {Directive[Opacity[0.55], Blue]}, GridLines -> {None, {0.5}}];
bothh = Plot[{v x/(-4 tr)}, {x, -20, -16}, AxesOrigin -> {0, 0}, Filling -> ro tr, FillingStyle -> {Directive[Opacity[0.55], Blue]},GridLines -> {None, {0.5}}];
Show[both, bothh, PlotRange -> All, Axes -> True,LabelStyle -> Directive[Large, Black]]

Could anyone help me?

*By extra line I mean the line which is created between two regions

$\endgroup$
4
  • $\begingroup$ Use PlotStyle -> None in both and bothh? $\endgroup$
    – kglr
    Commented Sep 28, 2017 at 15:27
  • $\begingroup$ It creates white points :( @kglr $\endgroup$ Commented Sep 28, 2017 at 15:32
  • $\begingroup$ or try Show[both, bothh, PlotRange -> All, Axes -> True, LabelStyle -> Directive[Large, Black]] /. Line[x_] :> Sequence[] $\endgroup$
    – kglr
    Commented Sep 28, 2017 at 15:41
  • $\begingroup$ It still creates white points @kglr $\endgroup$ Commented Sep 28, 2017 at 16:04

1 Answer 1

1
$\begingroup$
Plot[Max[ ro tr, v x/(-4 tr)], {x, -20, 0}, AxesOrigin -> {0, 0}, 
 Filling -> ro tr - 1, FillingStyle -> Opacity[0.55, Blue], 
 GridLines -> {None, {0.5}}, PlotRange -> All, Axes -> True, 
 LabelStyle -> Directive[Large, Black], Exclusions -> None]

enter image description here

$\endgroup$
3
  • $\begingroup$ There is still a white line. $\endgroup$ Commented Sep 28, 2017 at 16:19
  • $\begingroup$ @Albert, could you try the updated version with Exclusions->None? $\endgroup$
    – kglr
    Commented Sep 28, 2017 at 16:21
  • $\begingroup$ It works perfectly. Great answer! Thank you $\endgroup$ Commented Sep 28, 2017 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.