在Mathematica中的ListPlot中指定点样式

500*_*500 1 plot wolfram-mathematica point

考虑到

dacount = {{0, 69}, {1, 122}, {2, 98}, {3, 122}, {4, 69}}

ListPlot[dacount, AxesOrigin -> {-1, 0}, 
         PlotMarkers ->Automatic
         PlotStyle-> Lighter[Red, #] & /@ Range[0.5, 1, 0.1],
         Filling -> Axis, FillingStyle -> Opacity[0.8], 
         PlotRange -> {{-1, 4.5}, {0, 192}}]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我希望每一点都能采取不同的红色.但是我不明白如何设置一个样式,我试图设置为不同的列表.

小智 6

在原始代码中,PlotStyle选项不会影响标记符号,因此您可以将其保留.而是将PlotMarkers选项更改为以下内容:

PlotMarkers ->  With[{markerSize =  0.04}, 
 {Graphics[{Lighter[Red, #], Disk[]}], markerSize} & /@ Range[0.5, 1, 0.1]]
Run Code Online (Sandbox Code Playgroud)

在您通过以下方式替换列表dacount之前,这还不会产生预期的效果:

Map[List, dacount]
Run Code Online (Sandbox Code Playgroud)

通过以这种方式增加点列表的深度,从PlotMarkers中的列表为每个点分配其自己的标记样式.所以最终的代码是:

ListPlot[Map[List, dacount], AxesOrigin -> {-1, 0}, 
 PlotMarkers -> 
  With[{markerSize = 
     0.04}, {Graphics[{Lighter[Red, #], Disk[]}], markerSize} & /@ 
    Range[0.5, 1, 0.1]], Filling -> Axis, 
 FillingStyle -> Opacity[0.8], PlotRange -> {{-1, 4.5}, {0, 192}}]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述