Custom Intervals of Markers in Mathematica PlotMarkers

為{幸葍}努か 提交于 2019-12-10 14:56:04

问题


I am trying to plot multiple lists in the same plot in Mathematica (ListLinePlot) and use PlotMarkers and the PlotLegend Package to get the final figure. The issue is that Mathematica puts a marker for every point and this makes it hard to tell which marker is where in the plot. Is it possible to have a plot marker appear every n sample (e.g. every 10 points for a 100 point plot).

The Directive at the moment is PlotMarkers->{Automatic, Small}.


回答1:


If you want more control over the location of the plot markers than Brett's answer gives you, then you probably have to place the markers manually. Eg (modifying Brett's example)

data = Accumulate /@ RandomReal[{-1/2, 1}, {3, 100}];
col = {Red, Blue, Green};
decimate[i_] := {col[[i]], PointSize -> Medium, 
  Point /@ Transpose[{Range[1, 100, 10], data[[i, 1 ;; -1 ;; 10]]}]}
ListLinePlot[data, PlotStyle -> col, Epilog -> Table[decimate[i], {i, 3}]]

Of course Point can be replaced with any graphics object you want - eg Text, Inset etc...




回答2:


I think adding something like Mesh->10 should work for you:

data = Accumulate /@ RandomReal[{-1/2, 1}, {3, 100}];
ListLinePlot[data, PlotMarkers -> {Automatic, Small}, Mesh -> 10]




回答3:


Also remember you can use Tooltip to cause the marker coordinates to pop up when you pass the mouse pointer over it:




回答4:


The example of what I was describing in the comment. The markers don't behave properly.

Apparently I cannot post images yet, but running the following code

data = Accumulate /@ RandomReal[{-1/2, 1}, {3, 100}];
ListLinePlot[data, PlotMarkers -> {Automatic, Small}, Mesh -> 5]

should give improper results. Also the number of data and plots in the same figure is quite large to individually select which points and I would like to keep the same Directives for different plots and data ranges as they tend to vary between 100 to around 300 in each case and I have to save them in different tables as they are used in other calculations along the way.

Plot Posted by belisarius, running the code above



来源:https://stackoverflow.com/questions/4789047/custom-intervals-of-markers-in-mathematica-plotmarkers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!