windrose icon indicating copy to clipboard operation
windrose copied to clipboard

Similar issue & solution to previous issue

Open RobGLambert opened this issue 2 years ago • 1 comments

Being a meteorologist, I am not really interesting the Mathematical definition of degrees on a circle. But, rather the meteorological definition which has zero degrees pointed up, then increasing clockwise. This I believe was a similar issue to the closed post here. But I figured I would make a new thread to show how I solved this problem, making it abit cleaner.

As a user of this, it would be nice to pass an optional argument of "Math", "Met" or "Pollut". Which seems like the generic axis orientations that people are trying to accomplish in some threads I have seen.

The solution in the linked issue did help (though I needed to remove the ax.set_theta_direction(-1) for my dataset). But I figured I would add what I ended up doing to make this abit easier for some.

Instead of constructing the list myself I wrote it into a List Comprehension: [(i + 360) if i < 0 else i for i in range(90,-270,-10)])

so combined it looks like: ax.set_thetagrids(range(0,360,10),[ ( _+360) if _ < 0 else _ for _ in range(90,-270,-10) ] )

Which gave me the result I was looking for. output

RobGLambert avatar Mar 31 '23 18:03 RobGLambert

Just a comment about your list comprehension

Modulo can help.

[(90 - i) % 360 for i in range(0, 360, 10)]
  • 90 for EAST
  • -i for clockwise

Similar to #151

s-celles avatar Mar 31 '23 18:03 s-celles