-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
In the function expected_power_analysis_by.plot_with_distributions, the histogram of wind direction or wind speed bins that gets plotted has the wrong bin edges and includes the wrong bin count for the last bin. This is because the bins argument passed to sns.histplot here:
sns.histplot(
data=self.df_pandas, x=x_var, ax=axarr[1], bins=sorted(self.df_pandas[x_var].unique())
)
contains the bin centers instead of the bin edges. As a result, the last bin value shown contains the count for the last two wind direction or wind speed bins.
Expected Behavior
I would expect the histogram to have bin edges +/- 0.5*wd_step (or ws_step) from the bin centers, which would capture the correct count in each bin.
This could be fixed by passing the bin edges (using wd_step or ws_step) to sns.histplot, but I was thinking this could be a good opportunity to update expected_power_analysis_by.plot_with_distributions so the plots have the same format as those produced by energy_ratio_output.plot_uplift.
Steps To Reproduce
This behavior can be seen in the plots generated by t_wd.plot_with_distributions() in the examples_smarteole
/10_uplift_with_expected_power.ipynb" notebook. Note that the count shown in the last wind direction bin is greater than expected.
Environment
Anything else?
No response