PlotMarkers disappear when building exactly two polylines in Mathematica?

Not sure if this is an MMA error, or am I doing something wrong. Consider the following function:

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

Now consider the transmission of its values ​​generated by RandomReal. Namely, we consider

 RandomReal[1, {nTraces, nPointsPerTrace, 2(*constant = nDimensions*)}]. 

If nTraces is 1, then PlotMarkers are displayed for all nPointsPerTrace values ​​that I tried:

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

plotting random points when nTraces == 1

If nTraces is 3 or more, then construction markers are displayed for all the nPointsPerTrace values ​​that I tried

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

plotting random points when nTraces> = 3

But if nTraces is exactly 2, I do not see the graphics markers, regardless of the value of nPointsPerTrace:

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

plotting random points when nTraces == 2

Tips, tricks, tips will be greatly appreciated!

+4
source share
2 answers

It treats PlotMarkers -> {1,2} as a marker and size, and not as two markers:

 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]}}] 
+5
source

Things get even PlotMarkers when you try different things for PlotMarkers . The following does not display graphic markers, as in the examples above.

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

Mathematica graphics

However, when you change 2 to b , it does the following:

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

Mathematica graphics

If you try to change 1 to something, this will not work:

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

Mathematica graphics

It really sounds like an error, but I'm not sure if it depends on the version or some behavior that is not obvious.

+1
source

Source: https://habr.com/ru/post/1386415/


All Articles