5
$\begingroup$

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.

$\endgroup$
0

1 Answer 1

10
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ TNX. one more question: how to move lines between dots? $\endgroup$
    – StartX
    Commented Oct 31, 2013 at 17:22
  • $\begingroup$ Up in example we have 16 dot's conected with line's. I don't need line's, I need only dot's. Sorry for stupid question's. $\endgroup$
    – StartX
    Commented Nov 2, 2013 at 19:57
  • $\begingroup$ @StartX just skip the Joined->True part :) $\endgroup$
    – Kuba
    Commented Nov 2, 2013 at 20:18

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.