4
$\begingroup$

1. Problem statement

I want to display "categories" (f.e. the yearly winners of a football league) in a circular manner - a rounded version of OrdinalScale in a certain sense.

2. Toy data

data = {
   {"Chelsea", {1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0}},
   {"Arsenal", {0, 0.8, 0.8, 0.8, 0.8, 0, 0, 0, 0, 0, 0, 0}},
   {"City", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.6, 0.6}}} /. 0 :> Missing[];

3. My solution

ListPolarPlot[data[[All, 2]],
 BaseStyle -> PointSize[0.02],
 PlotLegends -> PointLegend[ColorData[97, "ColorList"][[1 ;; 3]], data[[All, 1]], LegendMarkerSize -> 15],
 PlotRangePadding -> 0.2,
 PlotRange -> {{-1, 1}, {-1, 1}},
 PolarAxes -> Automatic,
 PolarGridLines -> {Table[i, {i, 0, 2 Pi, 2 Pi/12}], {0.2, 0.4, 0.6, 0.8, 1.0}},
 PolarTicks -> {{{Pi/2, 2003}, {2 Pi, 2000}, {Pi, 2006}, {3 Pi/2, 2009}}, Automatic}]

enter image description here

4. Questions

  1. Is it possible to display the plot clockwise? 2000 at noon and then moving right?

  2. If a team wins several years in a row (f.e. Arsenal between 2001 and 2004), I would like to emphasize this by coloring the arc segments between the points (orange in this case).

  3. How can I change the color of the outermost circle (now black) to gray?

ListPolarPlot is the solution I found. Please feel free to propose other circle-like display styles.

5. Acceptance

I accepted Syed's answer, because it's easy to add the markers. For example:

data = {
   {"Chelsea", {1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0}},
   {"Arsenal", {0, 0.8, 0.8, 0.8, 0.8, 0, 0.8, 0, 0, 0, 0, 0}},
   {"City", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.6, 0.6}}};

RadialAxisPlot[data[[All, 2]],
 AxesOrigin -> {0, -1},
 Ticks -> Automatic,
 AxesLabel -> Range[2000, 2012],
 PlotMarkers -> {Automatic, 0.05},
 PlotLegends -> SwatchLegend[Automatic, data[[All, 1]]]]

enter image description here

$\endgroup$

2 Answers 2

6
$\begingroup$

I use v12.2 on Win7-x64 and the graphics rendering was sub-optimal for my version so I switched to the free cloud account.

$Version
data = {{"Chelsea", {1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 
    0}}, {"Arsenal", {0, 0.8, 0.8, 0.8, 0.8, 0, 0, 0, 0, 0, 0, 
    0}}, {"City", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.6, 0.6}}};

13.3.1 for Linux x86 (64-bit) (July 24, 2023)

RadialAxisPlot[data[[All, 2]], AxesOrigin -> {0, -1}, 
 Ticks -> Automatic, AxesLabel -> Range[2000, 2012]
 ,PlotLegends->SwatchLegend[Automatic, data[[All,1]]]
 ]

enter image description here

$\endgroup$
4
$\begingroup$

Playing with the options Axes, Ticks and AxesOrigin we can (1) eliminate the visual ambiguity regarding which year the zeros at the origin belong to, and (2) to get a quick/dirty compromise between linear/ordinal and cyclical views of time (this is accomplished by simply appending and prepending known histories with Nulls :))

radialorigin = .5;

RadialAxisPlot[
 Join[{Null, Null}, #, {Null}] & /@ AssociationThread @@ Transpose[data],
 AxesOrigin -> {{-Pi, -1}, radialorigin},
 Ticks -> {1 -> Range[0, 1., .2]},
 Axes -> 
   {2 | 3 + Max@Map[Length]@data[[All, 2]] -> False, _ -> Automatic},
 AxesLabel -> Join[{"", ""}, Range[2000, 2012]],
 PlotMarkers -> {Automatic, 0.05},
 PlotLegends -> Automatic,
 GridLines -> Range[radialorigin + .1, 1.2, .1]]

enter image description here

An alternative visualization is using ParallelAxisPlot

ParallelAxisPlot[data, 
  AxesStyle -> 
   {1 -> Directive[AbsoluteThickness[1], Gray],
    _ -> Directive[ Gray, FontOpacity -> 0]}, 
  AxesLabel -> Range[2000, 2012], 
  PlotRange -> {0, 1}, 
  PlotMarkers -> {Automatic, 0.05}, 
  PlotLegends -> data[[All, 1]], 
  ImageSize -> 1 -> 400] /. 
 l_Line :> {l, 
   Dynamic @ First @
     ListLinePlot[l[[1]], PlotHighlighting -> None, 
      PlotStyle -> CurrentValue["Color"], Filling -> Bottom]}

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.