Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Eliminating vertical lines in piecewise plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110230] Re: Eliminating vertical lines in piecewise plot
  • From: Helen Read <hpr at together.net>
  • Date: Wed, 9 Jun 2010 07:21:18 -0400 (EDT)
  • References: <hul8cf$ig6$1@smc.vnet.net>
  • Reply-to: HPR <read at math.uvm.edu>

On 6/8/2010 7:09 AM, erkutsonmez wrote:
> Hi All,
>
> I am plotting a piecewise function. Mathematica is joining the step
> points with vertical lines. How can I get rid of these vertical lines
> which makes my plot ugly. I tried Exclusions option but did not help.
>
> To be more specific I have the following plot:
>
> Plot[Piecewise[{{1,
>      First[Max[EBProfit1server1years1per, EBProfit2server1years1per] -
> CONProfit1per]>  0}}, 0], {x, 0,
>    2}, PlotStyle ->  {{Black, Thickness[0.004]}},
>   AxesStyle ->  Directive[Thick, 24, Bold], AxesOrigin ->  {0, 0},
>   PlotPoints ->  10000, MaxRecursion ->  15, AspectRatio ->  Automatic]
>
> where EBProfit1server1years1per, EBProfit2server1years1per, and
> CONProfit1per are also predefined piecewise functions. When I run this
> plot I see that mathematica is joining the step points with vertical
> lines. How can I avoid these vertical lines.

It would help if you post a specific example that demonstrates the 
behavior, that others can copy/paste into Mathematica and evaluate, 
instead of having to try to come with their own example. I tried to 
reproduce what you are talking about with Piecewise, and finally gave up.

Anyway, use Exclusions to exclude the step points.

f[x_] := Abs[x^2 - 4]/(x^2 - 4)

Plot[f[x], {x, -5, 5}]

Plot[f[x], {x, -5, 5}, Exclusions -> {-2, 2}]



--
Helen Read
University of Vermont


  • Prev by Date: Re: Push to clipboard?
  • Next by Date: difficulty using FindRoot
  • Previous by thread: Eliminating vertical lines in piecewise plot
  • Next by thread: Re: Eliminating vertical lines in piecewise plot