Wolfram mathematica 在Mathematica中精确绘制两条多段线时,绘图标记会消失吗?

Wolfram mathematica 在Mathematica中精确绘制两条多段线时,绘图标记会消失吗?,wolfram-mathematica,plot,Wolfram Mathematica,Plot,不确定这是MMA错误还是我做错了什么。 考虑以下功能: plotTrace[points_] := ListPlot[points, Joined -> True, PlotMarkers -> Table[i, {i, Length@points}]] 现在考虑通过随机实数生成的IT值。也就是说,考虑 RandomReal[1, {nTraces, nPointsPerTrace, 2(*constant = nDimensions*)}]. 如果nTraces为1

不确定这是MMA错误还是我做错了什么。 考虑以下功能:

plotTrace[points_] :=
 ListPlot[points,
  Joined -> True,
  PlotMarkers -> Table[i, {i, Length@points}]]

现在考虑通过随机实数生成的IT值。也就是说,考虑

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}]
=3“>

但如果nTraces正好是2,则无论nPointsPerTrace的值是多少,我都看不到绘图标记:

Manipulate[plotTrace[RandomReal[1, {2, nPointsPerTrace, 2}]],
 {nPointsPerTrace, 1, 20, 1}]


非常感谢您的提示、线索和建议!

当您尝试使用不同的
绘图标记时,事情会变得更加奇怪。以下内容不会显示绘图标记,如上面的示例所示

pts = RandomReal[1, {2, 10, 2}];
(* No markers *)
ListPlot[pts,
 Joined -> True,
 PlotMarkers -> {1, 2}
 ]

但是,当您将
2
更改为
b
时,它会:

pts = RandomReal[1, {2, 10, 2}];
(* Has markers *)
ListPlot[pts,
 Joined -> True,
 PlotMarkers -> {1, b}
 ]

如果您试图将
1
更改为某个内容,则该操作无效:

pts = RandomReal[1, {2, 10, 2}];
(* No markers *)
ListPlot[pts,
 Joined -> True,
 PlotMarkers -> {a, 2}
 ]


这听起来确实像一个bug,但我不确定这是版本相关的还是一些不明显的行为。

它将
PlotMarkers->{1,2}
视为一个标记和大小,而不是两个标记:

In[137]:= ListPlot[{{1, 2, 3}, {4, 5, 6}}, PlotMarkers -> {1, 2}] // InputForm

Out[137]//InputForm=
Graphics[GraphicsComplex[{{1., 1.}, {2., 2.}, {3., 3.}, {1., 4.}, {2., 5.}, {3., 6.}, 
  {1., 1.}, {2., 2.}, {3., 3.}, {1., 4.}, {2., 5.}, {3., 6.}}, 
  {{{Hue[0.67, 0.6, 0.6], Inset[Style[1, FontSize -> 2], 7], 
     Inset[Style[1, FontSize -> 2], 8], Inset[Style[1, FontSize -> 2], 9]}, 
    {Hue[0.9060679774997897, 0.6, 0.6], Inset[Style[1, FontSize -> 2], 10], 
     Inset[Style[1, FontSize -> 2], 11], Inset[Style[1, FontSize -> 2], 12]}, {}}}], 
 {AspectRatio -> GoldenRatio^(-1), Axes -> True, AxesOrigin -> {0, 0}, 
  PlotRange -> {{0, 3.}, {0, 6.}}, PlotRangeClipping -> True, 
  PlotRangePadding -> {Scaled[0.02], Scaled[0.02]}}]

有趣的是,我在Mathematica 8.0.1上得到了同样的结果。假设绘图标记可以是{marker,size},那么对于长度为2的选项列表,Mma似乎不确定是将其视为{marker,marker}还是{marker,size}。如果第二个元素是整数,则默认情况下,它似乎将列表视为{marker,size}。因此,绘图标记->{a,2}是“不可见的”因为FontSize->2本质上是不可见的。如果您想显式地使用整数2作为标签,可以执行PlotMarkers->{a,“2”}或只添加第三个元素PlotMarkers->{a,2,stuff}。是的,已验证。修复方法是
ListPlot[{{1,2,3},{4,5,6},PlotMarkers->ToString/@{1,2}]
,通常,只是将ToString映射到在我的常规函数
PlotTrace
中计算的plotmarker上。谢谢你的回答。刚刚验证了它也适用于
PlotMarkers->ToString/@Range[Length@points]
--这在各种版本7中肯定不起作用,所以这是一个改进。@Reb
PlotMarkers->ToString/@Range[Length@points]
在7.0.1版中正常运行。@Mr.Wizard--是,我在PlotMarkers中错误地使用了Range,它触发了一个bug,但是我从Wolfram那里得到了一个确认,确实存在一个bug(他们告诉我“使用表而不是Range”),所以这只是一个需要关注的问题,直到/如果我能找到旧的电子邮件。
ListPlot[{{1,2,3},{4,5,6},绘图标记->Transpose@List@{1,2}]
(或
ListPlot[{1,2,3},{4,5,6},PlotMarkers->List/{1,2}]
)似乎也能工作。