windrose icon indicating copy to clipboard operation
windrose copied to clipboard

Add feature: sector offset

Open lubyant opened this issue 3 years ago • 4 comments

Apply for the issue #235 Add an argument for the method such that the sector can be edited flexibly. For example

Picture1

By default (left), the first sector is [-11.25, 11.25].

dir = [360*random.random() for _ in range(400)]
spd = [5*random.random() for _ in range(len(dir))]
ax.bar(dir, spd, bins=bins, nsector=16)

Create an 11.25 offset for the sector (right), the first sector is [0, 22.5] and also for the other sectors. And, the bar is rotate 11.25 degrees.

dir = [360*random.random() for _ in range(400)]
spd = [5*random.random() for _ in range(len(dir))]
ax.bar(dir, spd, bins=bins, nsector=16, sectoroffset=11.25)

The same thing applies to the box plot, Picture2

lubyant avatar Apr 22 '23 22:04 lubyant

The code is solid and does what you need.

I'm not an expert here so can you explain a bit more on the use cases for this change? If we cannot get more experienced devs here to review I'm tempted to merge b/c this doesn't disrupt the conventional use anyway.

ocefpaf avatar Jun 12 '23 16:06 ocefpaf

This change appears to be a convenient way to enforce the "engineering" convention for windroses whereby the bars represent the direction the wind is blowing toward and not from (meteorology). Reviewing the PR, I do notice a spelling typo with offsect

akrherz avatar Jun 12 '23 17:06 akrherz

I made this pr because sometime I need to define the sector starting from 0, not -11.25 (for 16 sectors for example). I modify the setting to adapt this. However, I found that I might not correctly switch the histogram. Currently, I just simply switch the rose bar but I don't calculate the histogram based on new sectors. Please don't merge this pr. I will submit another pr to fix this issue.

lubyant avatar Jun 12 '23 17:06 lubyant

Hi @ocefpaf, I have made a few changes to incorporate the change in the histogram. Here is what it looks like. Can you review my pull request? image image

lubyant avatar Jun 17 '23 22:06 lubyant