5

How to Import data from excel and use them to Plot windrose instead?

Example, {{Strength, Angle(degrees)}..}

data = {{11.84,24.70}, {13.64,0}, {14.11,24.70}, {11.92,16.20}, {7.95,337.10}, 
        {8.34,326.60}, {7.85,335.40}, {8.90,6.30}, {10.43,338.40}, {10.36,325.60}, 
        {10.93,332.00}, {14.78,318.20}, {14.30,345.30}};

$0$ is North.

Kuba
  • 136,707
  • 13
  • 279
  • 740
StartX
  • 51
  • 4

1 Answers1

10

Let's say you've managed to import the data from excel and you want to transform list:

{{strength, angle}...}

so it fits the methods from the Q&A: How to create a wind rose with Mathematica?. There are couple of operations you must do:

r = Table[{RandomReal[{0, 20}], RandomReal[{0, 360}]}, {t, 0, 15}]; (*sample data*)
  • Your list is not sorted with the angle as it need to be for proper joining the points.
  • ListPolarPlot needs to get {angle, radius}...} type of list so in the second step we are doing that.
  • last step is only in order to close the line.

r = SortBy[r, Last]; 
r = {#2 Degree, #} & @@@ r;
AppendTo[r, r[[1]]];

ListPolarPlot[r, BaseStyle -> {Bold, 16}, Joined -> True, PlotMarkers -> Automatic, 
                 PolarGridLines -> {Range[0, 2 Pi, Pi/18], Automatic}, 
                 PolarTicks -> {"Direction", Automatic}, PolarAxes -> True, 
                 PlotStyle -> {PointSize[Large], Thick}, 
                 PolarAxesOrigin -> {Pi/2, 20}, PlotRange -> All]

enter image description here

Kuba
  • 136,707
  • 13
  • 279
  • 740