Re: Plotting w/o artifacts at discontinuities
- To: mathgroup@smc.vnet.net
- Subject: [mg12172] Re: Plotting w/o artifacts at discontinuities
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Fri, 1 May 1998 03:08:25 -0400
- References: <6hpeed$dck@smc.vnet.net>
Bruce Cohen %FEC wrote: > > I would like to be able to get plots that do not have artifacts from > discontinuities without having to know where the problem[s] will be in > advance. > > For example, I would like to be able to say > Plot[1/(1+x), {x,-2,1}] > and get a graph without the vertical line at x==-1. Though > p1=Plot[1/(1+x), {x,-2,-1}, DisplayFunction->Identity]; > p2=Plot[1/(1+x), {x,-1,1}, DisplayFunction->Identity]; > Show[p1,p2, DisplayFunction->$DisplayFunction]; does the trick, it > requires my anticipation of the problem at x==1. > > Thanks. Bruce, Here is a starter: we split the line where it becomes too steep. A lot more needs to be done to take account of things like the difference between perceived slope and calculated slope - and it would be useful to have the slope size that causes the split to be controled by an option. plt=Plot[1/(1+x), {x,-2,1}] Show[plt/.Line[lst_]:> Line/@Split[lst,Abs[Divide@@Reverse[#2-#1]]<10^4&]] -- Allan Hayes Training and Consulting Leicester, UK hay@haystack.demon.co.uk http://www.haystack.demon.co.uk voice: +44 (0)116 271 4198 fax: +44 (0)116 271 8642