4
daList={{0.059, 0.298, 0.726, 0.735, 1.461, 2.311, 3.315}, 
        {0.05, 0.404,0.664, 0.782, 1.376, 2.328, 3.432}, 
        {0.087, 0.628, 0.986, 1.187,1.914, 3.481, 4.993}, 
        {0.073, 0.594, 0.975, 1.147, 2.019, 3.417,5.037}, 
        {0.143, 0.821, 1.442, 1.595, 2.983, 4.98, 7.604}, 
        {0.107,0.871, 1.431, 1.684, 2.964, 5.015, 7.394}}


ListPlot[daList,
         Joined -> True,
         PlotRange -> {{1, 7}, {0, 7}}, 
         PlotStyle -> {{Thick, Lighter[Red, .5]}, 
                       {Dashed, Black}, 
                       {Thick,Lighter[Red, .3]}, 
                       {Dashed, Black}, 
                       {Thick,Lighter[Red, .1]}, 
                       {Dashed, Black}},
         Prolog ->{GrayLevel[0.5], EdgeForm[Thickness[.005]], 
                   Rectangle[{1.01, 0.01}, {6.99, 6.99}]}]

在此处输入图像描述

如您所见,我需要为每一行分配不同的指令。

我希望黑色虚线是点(已连接-> 假)。

我还不能掌握为子列表分组指令的方法

感谢您的关注。

4

3 回答 3

6

如果您希望加入所有其他情节,您可以设置Joined->{True, False},例如

ListPlot[daList, Joined -> {True, False}, 
 PlotRange -> {{1, 7}, {0, 7}}, 
 PlotStyle -> {{Thick, Lighter[Red, .5]}, {Dashed, Black}, {Thick, 
    Lighter[Red, .3]}, {Dashed, Black}, {Thick, 
    Lighter[Red, .1]}, {Dashed, Black}}, 
 Prolog -> {GrayLevel[0.5], EdgeForm[Thickness[.005]], 
   Rectangle[{1.01, 0.01}, {6.99, 6.99}]}]

产生

加入/未加入

编辑

关于您的评论,我想您总是可以分别绘制偶数组和奇数组点并将它们与 show 结合起来。所以对于你的例子:

joinedStyle = {Thick, Lighter[Red, #]} & /@ {.5, .3, .1};
pointStyle = Black;

plot1 = ListPlot[daList[[1 ;; ;; 2]], Joined -> True, PlotStyle -> joinedStyle,
  PlotRange -> {{1,7},{0,7}}];
plot2 = ListPlot[daList[[2 ;; ;; 2]], Joined -> False, PlotStyle -> pointStyle];
Show[plot1, plot2, PlotRange -> {{1, 7}, {0, 7}}, 
  Prolog -> {GrayLevel[0.5], EdgeForm[Thickness[.005]], 
    Rectangle[{1.01, 0.01}, {6.99, 6.99}]}]
于 2011-10-15T16:39:27.173 回答
4

您可以考虑单独构建您的地块,并使用Show. 这是一个希望离目标不太远的示例。

{d1, d2} = Partition[daList, 2]\[Transpose];
lambda = {541, 550, 560, 570, 580, 590, 600};
colors = {Thick, Red~Lighter~#} & /@ {0.5, 0.3, 0.1};

g1 = ListPlot[d1, Joined -> True, PlotStyle -> colors];
g2 = ListPlot[d2, PlotStyle -> {{Black, AbsolutePointSize[5]}}];

Show[{g1, g2}, PlotRange -> {{1, 7}, {0, 7}}, 
 AspectRatio -> 1/GoldenRatio, Frame -> True, FrameStyle -> 20, 
 FrameTicks -> {{Automatic, 
    None}, {MapIndexed[{#2[[1]], #} &, lambda], Automatic}}, 
 Prolog -> {GrayLevel[0.5], EdgeForm[Thickness[.005]], 
   Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]}, ImageSize -> 600]

我想我在这里几乎是在抄袭黑克,但这不是故意的。希望这两个答案都能增加一些东西。

有一个更完整的例子来说明Scaled这个ImageScaled应用程序的使用:https ://stackoverflow.com/questions/6303500/mathematica-matlab-like-figure-plot

于 2011-10-15T16:22:02.570 回答
3

作为 的替代方案ListPlot,您可以考虑Graphics

tdata = MapIndexed[{#2[[1]], #1} &, #] & /@ daList;

Graphics[
 { GrayLevel[0.7], EdgeForm[AbsoluteThickness[2]], 
  Rectangle[{1.02, 0.05}, {7.2, 7.75}],
  (*lines*)
  AbsoluteThickness[2], 
  Transpose[{Lighter[Red, #] & /@ {0.5, 0.3, 0.1}, 
    Line@tdata[[#]] & /@ {1, 3, 5}}],
  (*points*)
  Black, PointSize[0.016],
  Point@tdata[[#]] & /@ {2, 4, 6}
  }, Axes -> True, PlotRange -> {{1, 7.2}, {0, 7.8}},
 AspectRatio -> 1/GoldenRatio]

在此处输入图像描述

或者,给每个数据集一个不同的符号,如下图所示:

在此处输入图像描述

代码:

Graphics[
 { GrayLevel[.7], EdgeForm[AbsoluteThickness[2]], 
  Rectangle[{1.02, 0.05}, {7.2, 7.75}],

  (*lines*)
  AbsoluteThickness[2], 
  Transpose[{Lighter[Red, #] & /@ {0.5, 0.3, 0.1}, 
    Line@tdata[[#]] & /@ {1, 3, 5}}],

  (*points*)

  Inset[Graphics[{EdgeForm[Black], White, Rectangle[]}, 
      ImageSize -> 8], #] & /@ tdata[[2]],
  Inset[Graphics[{EdgeForm[Black], White, 
       Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]}, 
      ImageSize -> 10], #] & /@ tdata[[4]],
  Inset[Graphics[{ EdgeForm[Black], White, Disk[]}, 
      ImageSize -> 9], #] & /@ tdata[[6]]

  }, Axes -> True, PlotRange -> {{1, 7.2}, {0, 7.8}},
 AspectRatio -> 1/GoldenRatio]
于 2011-10-16T10:56:35.003 回答