python-windrose / windrose

A Python Matplotlib, Numpy library to manage wind data, draw windrose (also known as a polar rose plot), draw probability density function and fit Weibull distribution
https://python-windrose.github.io/windrose
Other
339 stars 133 forks source link

Weibull subplots #254

Open GoodLug opened 1 year ago

GoodLug commented 1 year ago

I am trying to plot Weibull plots in a subplot, using code based on that in the Usage documentation for Probability density function (pdf) and fitting Weibull distribution. My relevant code, which uses a loop, is intended to generate ten subplots, one for a particular month in each year in a decade, is as follows:

fig = plt.figure(figsize=(12,8))

for i in range(0, yCount):

 ... get and process the data for the current plot (working fine)...

   ax = fig.add_subplot(3, 4, int(i)+1)
   ax = WindAxes.from_ax()
   ax, params = ax.pdf(df['speed'], bins=8)

The plots get created, but separately, ie not inside the main 'fig' plot, and I end up with 11 Figure windows, one with the main plot with empty rectangles, and 10 with the correct Weibull plots, ie everything is working, I can even access the params, except the subplots don't come out as subplots.

Any advice you can offer?