Forum Discussion
WIndrose plot in power BI
Hi mmvohra
Thanks for the reply from lbendlin , please allow me to provide another insight:
Power BI supports Python scripts, which can be used to create a wide range of custom visualizations, including wind rose diagrams. You'll need to have Python installed on your machine along with the necessary libraries.
Ensure your dataset includes columns for wind direction (in degrees from 0 to 360) and wind speed. The data should be clean and ready for visualization.
Add a Python visual to your report and add the necessary fields to the Values section.
Use the following sample Python script, adjusting it to fit your dataset's column names:
Here for your reference:
import matplotlib.pyplot as plt
from windrose import WindroseAxes
# Sample data
direction = dataset['Direction'] # Replace 'Direction' with your column name for wind direction
speed = dataset['Speed'] # Replace 'Speed' with your column name for wind speed
# Create wind rose plot
ax = WindroseAxes.from_ax()
ax.bar(direction, speed, normed=True, opening=0.8, edgecolor='white')
ax.set_legend()
plt.show()
You can adjust the script to customize the appearance of your wind rose diagram. The library offers several options for customization, including changing the color, the number of direction bins, and more.
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Good day,
Thanks. I was able to get the windrose built in the power bi desktop but that particually visual cannot displayed after I published the report to a workspace, with runtime error. see message detail here. can you please advice what should be done in order to let the visual display in a published report? Thanks
Script Runtime Error
[S-9263c0fe-64c3-422d-b386-7d82544a7cd8][S-9263c0fe-64c3-422d-b386-7d82544a7cd8]ModuleNotFoundError: No module named 'windrose'