MathGroup Archive 2010

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

Search the Archive

Re: Eliminating vertical lines in piecewise plot

  • To: mathgroup at
  • Subject: [mg110229] Re: Eliminating vertical lines in piecewise plot
  • From: "David Park" <djmpark at>
  • Date: Wed, 9 Jun 2010 07:21:07 -0400 (EDT)

A regular Piecewise Plot of a discontinuous function does not draw the
vertical lines. So we would have to know more.

1) It is better if you can post evaluable code that illustrates the problem.

2) If you have trouble with a plot, and the function being plotted is quite
involved, then it might help to look at the function outside the plot to
better understand its characteristics and perhaps simplify it.
(PiecewiseExpand?) Also it may be more efficient if a plot function can be
calculated and defined first outside of the plot.

3) Using 10000 plot points and MaxRecursion 15 is pure brute force and there
is probably a simpler answer.

4) The Presentations package has routines SplitLineOnDistance,
SplitLineOnSlope and SplitLineOnVertical that are sometimes convenient for
eliminating such "return line segments", but if we knew your function better
it might be possible to use the regular Exclusion option. I'm not certain
why the default Exclusions value is not working, but Mathematica is not
recognizing the discontinuities and we can't know why unless we know more
about your function.

David Park
djmpark at  

From: erkutsonmez [mailto:erkuts at] 

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:

    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.

Thanks for the help.

  • Prev by Date: Re: Using Mathematica to create simple HTML webpages
  • Next by Date: Re: Programatically creating delayed assignment
  • Previous by thread: Re: Eliminating vertical lines in piecewise plot
  • Next by thread: Re: DynamicModule and FileNameSetter problem