当ListPlot使用Mathematica绘制数据表时,如何避免渐近线?

时间:2011-12-09 03:24:58

标签: wolfram-mathematica

我正在使用Mathematica中的ListPlot绘制数据表。我注意到图中有一些渐近线,我不希望它被绘制(即曲线之间的直线)。我该怎么做才能删除直线?

3 个答案:

答案 0 :(得分:3)

也许:

t = Table[Tan[i], {i, -Pi, Pi, .01}];
ListPlot[#, Joined -> True] & /@ {t, t /. x_ /; Abs@x > 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]

答案 1 :(得分:3)

Mark 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]

答案 2 :(得分: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]