Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved wind rose plot #968

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions floris/wind_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from abc import abstractmethod
from pathlib import Path

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -692,7 +693,7 @@
color_map="viridis_r",
wd_step=None,
ws_step=None,
legend_kwargs={"title": "Wind speed [m/s]"},
legend_kwargs={"label": "Wind speed [m/s]"},
):
"""
This method creates a wind rose plot showing the frequency of occurrence
Expand Down Expand Up @@ -738,6 +739,8 @@

# Get a color array
color_array = plt.get_cmap(color_map, len(ws_bins))
norm_ws = mpl.colors.Normalize(vmin=np.min(ws_bins), vmax=np.max(ws_bins))
sm_ws = mpl.cm.ScalarMappable(norm=norm_ws, cmap=color_array)

Check warning on line 743 in floris/wind_data.py

View check run for this annotation

Codecov / codecov/patch

floris/wind_data.py#L742-L743

Added lines #L742 - L743 were not covered by tests

for wd_idx, wd in enumerate(wd_bins):
rects = []
Expand All @@ -755,7 +758,10 @@
)

# Configure the plot
ax.legend(reversed(rects), ws_bins, **legend_kwargs)
# ax.legend(reversed(rects), ws_bins, **legend_kwargs)
cb_ws = ax.figure.colorbar(sm_ws, ax=ax, **legend_kwargs)
ax.figure.tight_layout()
cb_ws.outline.set_visible(False)

Check warning on line 764 in floris/wind_data.py

View check run for this annotation

Codecov / codecov/patch

floris/wind_data.py#L762-L764

Added lines #L762 - L764 were not covered by tests
ax.set_theta_direction(-1)
ax.set_theta_offset(np.pi / 2.0)
ax.set_theta_zero_location("N")
Expand Down
Loading