1
$\begingroup$

I'm struggling to generate rose plots that have the ability to plot multiple measurands that can be both positive and negative. Here's an example of something (from Excel !) that I seem to be having trouble generating in Mma. wind rose plot of WYM You notice I am plotting multiple datasets which have positive and negative quantities, as a function of wind bearing. This sort of thing is typically used for displaying wind yaw misalignment of a wind turbine measured by a lidar operating at multiple ranges. ListPolarPlot is a bit of a non-starter, as the centre of the plot is always at zero (I'd like it at, say, -10). SectorChart doesn't handle this sort of thing either. The solutions to similar questions on stackoverflow don't seem to be applicable: they plot positive quantities, and sometimes don't allow multiple datasets to be combined. I need something like a ListCircularPlot ! Anything that avoid me having to use all graphics primitives is appreciated. Thanks

$\endgroup$
  • $\begingroup$ If you know your data is always above 10, then why not preprocess the data (by subtracting 10) and then use ListPolarPlot? $\endgroup$ – bill s Feb 20 '18 at 16:04
  • $\begingroup$ Thanks Bill. Yes, I've done that - but then how do I label the radial axis easily ? $\endgroup$ – ouzel Feb 20 '18 at 16:34
  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/questions/31257/…, maybe also mathematica.stackexchange.com/questions/128330/… $\endgroup$ – Michael E2 Feb 20 '18 at 16:53
  • $\begingroup$ They are not duplicates, as none of those plotted negative data. I did look at them before posting, but thanks for checking. $\endgroup$ – ouzel Feb 21 '18 at 11:28
3
$\begingroup$

You can use ListPolarPlot and modify the ticks to show negative radial values. Here's some data:

data = Range[-30, 30];

And the plot:

ListPolarPlot[
    data+30, (* rescale data *)
    PolarAxes->True,
    PolarGridLines->{Automatic, Range[-30,30,10]+30},
    PolarTicks->{Automatic, Thread[{Range[0,60,10], Range[0,60,10]-30}]}
]

enter image description here

Addendum

(The OP requested to put the origin at the top as well)

There is no simple way to put the origin at the top. One workaround is to modify your data so that it starts at $90^\circ$ and then modify the ticks as well. Here is some sample data:

data = Thread[{Range[0, 360, 10] Degree, Range[-18, 18]}];

We need to translate both the angle and the radius, which can be done using TranslationTransform (and in many other ways as well). The following ListPolarPlot call translates the data and modify the ticks:

ListPolarPlot[
    TranslationTransform[{90 Degree, 18}][data],
    PolarAxes->True,
    PolarTicks->
        {
        Table[{x, Mod[x+270, 360]} Degree, {x, 0,360, 10}],
        Table[{x, x-20}, {x, 0, 40, 10}]
        },
    PolarGridLines -> {Automatic, {10,20,30,40}}
]

enter image description here

$\endgroup$
  • $\begingroup$ The above looked to be a great solution, but alas does not work for me due to a flaw (bug ?) in mma v7 e.g. see: ! photos.app.goo.gl/HBtu2WrKZGhCRByk2 (hope that graphics link thing works) Basically mma 7 reports an error: "PolarAxes::polarticks: Value of PolarTicks -> {{0,270 [Degree]},{10 [...][Degree],250 [Degree]},{350 [Degree],260 [Degree]},{360 [Degree],270 [Degree]}} should be None, Automatic, or a list of tick specifications. >>" And does so even for its own help documentation examples using PolarTicks. So I suppose I am a bit stuck ! $\endgroup$ – ouzel Feb 26 '18 at 17:18
  • $\begingroup$ @ouzel I don't have M7 available to test, but perhaps you can try using Table[{N@x, Mod[x+270, 360]} Degree, {x, 0,360, 10}] instead? $\endgroup$ – Carl Woll Feb 26 '18 at 18:12
  • $\begingroup$ Thanks Carl, but still broken. Perhaps the PolarTicks issue is a problem with Windows Mma v7 :-( $\endgroup$ – ouzel Feb 27 '18 at 10:00
  • $\begingroup$ And I needed the polar angle increasing monotonic clockwise (to fit with the conventional definition of an angle bearing) ! $\endgroup$ – ouzel Feb 27 '18 at 11:58
  • $\begingroup$ But that can be done by negating the angle of the initial data e.g. Map[{- #[[1]], #[[2]]} &,data] as well as appropriate choice of PolarTicks (in non v7) $\endgroup$ – ouzel Mar 8 '18 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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