在 Mathematica 中绘制两条折线时 PlotMarkers 消失?
不确定这是 MMA 错误还是我做错了什么。 考虑以下函数:
plotTrace[points_] :=
ListPlot[points,
Joined -> True,
PlotMarkers -> Table[i, {i, Length@points}]]
现在考虑向其传递由 RandomReal 生成的值。即,考虑
RandomReal[1, {nTraces, nPointsPerTrace, 2(*constant = nDimensions*)}].
如果 nTraces 为 1,则为我尝试过的 nPointsPerTrace 的所有值显示 PlotMarkers:
Manipulate[
plotTrace[RandomReal[1, {1, nPointsPerTrace, 2}]],
{nPointsPerTrace, 1, 20, 1}]
如果 nTraces 为 3 或更大,则为我尝试过的 nPointsPerTrace 的所有值显示绘图标记
Manipulate[plotTrace[RandomReal[1, {nTraces, nPointsPerTrace, 2}]],
{nTraces, 3, 20, 1}, {nPointsPerTrace, 1, 20, 1}]
但是如果 nTraces 恰好为 2,则无论值是多少,我都看不到绘图标记nPointsPerTrace:
Manipulate[plotTrace[RandomReal[1, {2, nPointsPerTrace, 2}]],
{nPointsPerTrace, 1, 20, 1}]
提示、线索、建议不胜感激!
Not sure if this is a MMA bug or me doing something wrong.
Consider the following function:
plotTrace[points_] :=
ListPlot[points,
Joined -> True,
PlotMarkers -> Table[i, {i, Length@points}]]
now consider passing it values generated by RandomReal. Namely, consider
RandomReal[1, {nTraces, nPointsPerTrace, 2(*constant = nDimensions*)}].
If nTraces is 1, then PlotMarkers are displayed for all values of nPointsPerTrace that I tried:
Manipulate[
plotTrace[RandomReal[1, {1, nPointsPerTrace, 2}]],
{nPointsPerTrace, 1, 20, 1}]
If nTraces is 3 or greater, then plot markers are displayed for all values of nPointsPerTrace that I tried
Manipulate[plotTrace[RandomReal[1, {nTraces, nPointsPerTrace, 2}]],
{nTraces, 3, 20, 1}, {nPointsPerTrace, 1, 20, 1}]
But if nTraces is exactly 2, I don't see plot markers, no matter the value of nPointsPerTrace:
Manipulate[plotTrace[RandomReal[1, {2, nPointsPerTrace, 2}]],
{nPointsPerTrace, 1, 20, 1}]
Hints, clues, advice would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它正在处理 PlotMarkers -> {1,2} 作为标记和大小,而不是作为两个标记:
It's treating
PlotMarkers -> {1,2}
as a marker and size, instead of as two markers:当您为
PlotMarkers
尝试不同的操作时,事情会变得更加奇怪。下面不显示绘图标记,如上面的示例所示。但是,当您将
2
更改为b
时,它确实如此:如果您尝试将
1
更改为某些内容,则不会工作:这确实听起来像一个错误,但我不确定这是否与版本相关或某些不明显的行为。
Things get even stranger when you try different things for
PlotMarkers
. The following does not display the plot markers, as in your examples above.However, when you change the
2
tob
, it does:If you try to change the
1
to something, it doesn't work:It does indeed sound like a bug, but I'm not sure if this is version dependent or some behavior that's not obvious.