这是我第一次发帖,所以如果根据预先存在的问题提出新问题是不好的形式,我深表歉意。
我正在尝试创建一个类似于此处介绍的“圈表”:
我的需要有点曲折。我正在绘制不同运动的圈速位置,我的数据结构不同。数据按车队和每圈完成时车队所处的位置列出。例如,这里是一个数据样本:
BRA = {03, 01, 01, 01};
CAN = {14, 14, 06, 10};
CRO = {10, 08, 11, 12};
DEN = {05, 05, 04, 11};
FRA = {13, 11, 14, 13};
GBR = {04, 02, 02, 02};
GER = {15, 15, 12, 09};
GRE = {16, 16, 16, 16};
IRL = {01, 03, 08, 06};
NOR = {02, 04, 09, 05};
NZL = {06, 06, 05, 08};
POL = {08, 07, 03, 03};
POR = {11, 13, 15, 15};
SUI = {07, 09, 10, 07};
SWE = {09, 10, 07, 04};
USA = {12, 12, 13, 14};
在这个例子中,巴西在第一圈结束时排在第三位,然后在第二圈结束时进入第一,保持第三圈的位置,然后到达终点。
我已经创建了我需要的图表,方法是手动重新键入数据以适应前面示例中发布的代码,但必须有一种更有效的方法。任何建议表示赞赏。
另一个问题......目前在给定一圈结束时的位置是均匀分布的,但在真正的比赛中,第一名比第二名领先 20 秒,而第三名可能领先 10 秒。有没有办法绘制每个位置以反映下一个竞争对手之前的相对时间?
这是我当前的工作代码:
data = {{09, 10, 01, 06, 04, 11, 14, 12, 15, 03, 13, 16, 05, 02, 07, 08},
{01, 06, 09, 10, 04, 11, 12, 03, 14, 15, 05, 16, 13, 02, 07, 08},
{01, 06, 12, 04, 11, 02, 15, 09, 10, 14, 03, 07, 16, 05, 13, 08},
{01, 06, 12, 15, 10, 09, 14, 11, 07, 02, 04, 03, 05, 16, 13, 08}};
{p, n} = {Max@data, Length@data};
ListLinePlot[
Replace[Array[data~Position~# &,
p], {lap_, y_} :> {lap - 1, -y}, {2}],
Frame -> True,
FrameLabel -> {"Rounding", "Position", "Rounding",
"Final Positions"}, GridLines -> {Range[0, n + 1], None},
FrameTicks -> {
{{{-1, "IRL"}, {-2, "NOR"}, {-3, "BRA"}, {-4, "GBR"}, {-5,
"DEN"}, {-6, "NZL"}, {-7, "SUI"}, {-8, "POL"}, {-9,
"SWE"}, {-10, "CRO"}, {-11, "POR"}, {-12, "USA"}, {-13,
"FRA"}, {-14, "CAN"}, {-15, "GER"}, {-16, "GRE"}},
{{-1, "1 BRA"}, {-2, "2 GBR"}, {-3, "3 POL"}, {-4, "4 SWE"}, {-5,
"5 NOR"}, {-6, "6 IRL"}, {-7, "7 SUI"}, {-8, "8 NZL"}, {-9,
"9 GER"}, {-10, "10 CAN"}, {-11, "11 DEN"}, {-12,
"12 CRO"}, {-13, "13 FRA"}, {-14, "14 USA"}, {-15,
"15 POR"}, {-16, "16 GRE"}}},
{{{0, "W1"}, {1, "L1"}, {2, "W2"}, {3, "F"}},
{{0, "W1"}, {1, "L1"}, {2, "W2"}, {3, "F"}}}},
PlotRange -> {Automatic, {-.7, -.3 - p}},
PlotStyle -> Thickness[.003]]