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

3

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


6
你能给出一个你正在绘制的示例数据集吗? - Brett Champion
1
你确定你说的是渐近线吗?我有这样的印象,你在谈论数据中的间隙。渐近线并不是“曲线之间的直线”。 - Sjoerd C. de Vries
2
也许这个 Stack Overflow 的问题(http://stackoverflow.com/q/4382610/499167)会引起您的兴趣? - 681234
3个回答

3
也许:
t = Table[Tan[i], {i, -Pi, Pi, .01}];
ListPlot[#, Joined -> True] & /@ {t, t /. x_ /; Abs@x > 10 -> None}

这里输入图片描述

编辑

更加健壮:

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

以下内容翻译自Mark McClure在这里的帖子: 如何注释ListPlots中的多个数据集

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

OP 要求的是 ListPlot,而不是 ListLinePlot。 - Dr. belisarius
@Simon 可能是这样,但是发布的解决方案在 我的 机器上无法与 ListPlot 一起使用。 - Dr. belisarius

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]

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接