Motorsport Chart Diagram Using ListLinePlot

I am trying to take a table of crank positions in motorsport and build a graph like this http://www.fia.com/en-GB/sport/championships/f1/2010/bahrain/Pages/lap_chart.aspx .

Each line corresponds to a circle with the first circle in the first line. Car numbers are indicated on each line in the order they pass the start / end line. The table may look like this (4-car race, 6 laps:

1 3 2 4
1 3 2 4
1 3 4 2
3 1 4 2
3 1 4 2
3 4 1 2

In the above example, the order was 1,3,2,4 after the first lap, and by the end of the 6 lap race, car 3 won, car 4 took second place, etc.

It is easy to build it wrong, I did this:

ListLinePlot[Table[Position[data,x],{x,4}]]

Mathematica graphics

, 1- , y 4-3-2-1, 1- .

y , 1 () n ()?

+5
6

Quadrant 4 .

DNF! (, ).

y = -1, y = -2 .. , y -y {{lap_, y_} :> {lap - 1, -y}} .

lap 1, (lap = zero).


, , . - Mr.Wizard


data = 
  {{1, 3, 2, 4},
   {1, 3, 2, 4},
   {1, 3, 4, 2},
   {3, 1, 4, 2},
   {3, 1, 4, 2},
   {3, 4, 1, 2}};

{p, n} = {Max@data, Length@data};

ticks = {#, #} &@Array[{-#, #} &, p];
ticks[[All, 1, 2]] = {"Pole", "Winner"};

PrependTo[data, Range@p];  (* add starting position *)

ListLinePlot[
 Replace[
   Array[data~Position~# &, p],
   {lap_, y_} :> {lap - 1, -y},
   {2}
 ],
 Frame -> True,
 FrameLabel ->
  {"Laps Completed",
   "Starting Positions",
   "Laps Completed",
   "Final Positions"},
 GridLines -> {Range[0, n + 1], None},
 FrameTicks -> {ticks, {All, All}},
 PlotRange -> {Automatic, {-.7, -.3 - p}},
 PlotStyle -> Thickness[.01]
]

race cars

, №1 (, ), . , № 3 .

DNF

+7

, :

ListLinePlot[
 Table[Position[data, x] /. {xx_, yy_} :> {xx, 5 - yy}, {x, 4}],
 Ticks -> {Automatic, {{1, 4}, {2, 3}, {3, 2}, {4, 1}}}, 
 PlotStyle -> Thickness[.01]]

enter image description here

+6

, - BarChart ScalingFunctions, ....

BarChart[Ordering /@ data, ChartLayout -> "Overlapped", 
 Joined -> Automatic, BarSpacing -> 0, ChartElementFunction -> ({} &),
  ChartStyle -> 1, ScalingFunctions -> "Reverse", Axes -> False, 
 Frame -> {{True, False}, {True, False}}, PlotRange -> {All, All}, 
 BaseStyle -> Thickness[0.01]]

Barchart-based solution

( ListPlot, , . , ScalingFunctions.)

+4

"" , , .

laps = 
  {{1, 3, 2, 4},
   {1, 3, 2, 4},
   {1, 3, 4, 2},
   {3, 1, 4, 2},
   {3, 1, 4, 2},
   {3, 4, 1, 2}};

ListLinePlot[
  -Thread[Ordering /@ laps],
  AxesOrigin -> {1, 0}, PlotStyle -> Thick,
  Ticks -> {All, Array[{-#, #} &, 4]}
]

enter image description here

+3

y :

data = {{1, 3, 2, 4},
   {1, 3, 2, 4},
   {1, 3, 4, 2},
   {3, 1, 4, 2},
   {3, 1, 4, 2},
   {3, 4, 1, 2}};

ListLinePlot[Table[Position[5 - data, x], {x, 4}], 
 Axes -> {True, False}]

Mathematica graphics

+2

ScalingFunctions ListLinePlot

data = {{1, 3, 2, 4}, {1, 3, 2, 4}, {1, 3, 4, 2}, {3, 1, 4, 2}, {3, 1,
     4, 2}, {3, 4, 1, 2}};
ListLinePlot[Table[Position[data, x], {x, 4}], 
 ScalingFunctions -> {Identity, "Reverse"}, AxesOrigin -> {1, -5}]

, AxesOrigin y .

Mathematica graphics

+1

All Articles