2011-12-09 30 views
3

我在Mathematica中繪製使用ListPlot的數據表。我注意到圖中有幾個漸近線,我不希望它被繪製(即曲線之間的直線)。我該怎麼做才能刪除直線?如何避免使用Mathematica ListPlot數據表時的漸近線?

+6

你能給你繪製一個例子集? –

+1

你確定你在談論漸近線嗎?我的印象是你在談論數據中的差距。漸近線不是「曲線之間的直線」 –

+2

也許[this](http://stackoverflow.com/q/4382610/499167)SO問題很有趣? – tomd

回答

3

也許:

t = Table[Tan[i], {i, -Pi, Pi, .01}]; 
ListPlot[#, Joined -> True] & /@ {t, t /. x_ /; [email protected] > 10 -> None} 

enter image description here

編輯

更強大:

t = Table[Tan[i], {i, -Pi, Pi, .01}]; 
ao = AbsoluteOptions[ListPlot[t, Joined -> True],PlotRange]/. {_ -> {_,x_}} ->x; 
ListPlot[t /. x_ /; (x < ao[[1]] || x > ao[[2]]) -> None, Joined -> True] 
3

馬克McClure的帖子在這裏的方法:How to annotate multiple datasets in ListPlots

t = Table[Tan[i], {i, -Pi, Pi, .01}]; 
plot = ListLinePlot[t]; 
DeleteCases[plot, Line[_?(Length[#] < 4 &)], Infinity] 
+0

該OP問ListPlot,而不是ListLinePlot –

+1

@belisarius:[「ListLinePlot是一個ListPlot的特例」](http://reference.wolfram.com/mathematica/ref/ListLinePlot.html#528126457) – Simon

+0

@Simon可能是,但發佈的解決方案無法在_my_機器中使用ListPlot –

0
t = Table[Tan[i], {i, -Pi, Pi, .01}]; 
plot = ListLinePlot[t]; 

使用Position

Position[plot, Line[___], Infinity] 

{{1,1,3,2},{1,1,3,3},{1,1,3,4}, {1,1,3,5},{1,1,3,6}}

使用Part

plot[[1, 1, 3, 5 ;; 6]] = Sequence[]; Show[plot] 
相關問題