title: ValueError: Number of rows must be a positive integer, not 3.0
body: <p>I have this code:</p>
  <pre><code>import numpy as np
  from scipy import stats
  from matplotlib import pyplot as plt
  
  if __name__ == &quot;__main__&quot;:
      # Create a list of the number of coin tosses (&quot;Bernoulli trials&quot;)
      number_of_trials = [0, 2, 10, 20, 50, 500]
      # Conduct 500 coin tosses and output into a list of 0s and 1s
      # where 0 represents a tail and 1 represents a head
      data = stats.bernoulli.rvs(0.5, size=number_of_trials[-1])
      # Discretise the x-axis into 100 separate plotting points
      x = np.linspace(0, 1, 100)
      # Loops over the number_of_trials list to continually add
      # more coin toss data. For each new set of data, we update
      # our (current) prior belief to be a new posterior. This is
      # carried out using what is known as the Beta-Binomial model.
      # For the time being, we won’t worry about this too much.
      for i, N in enumerate(number_of_trials):
          # Accumulate the total number of heads for this
          # particular Bayesian update
          heads = data[:N].sum()
          # Create an axes subplot for each update
          ax = plt.subplot(len(number_of_trials) / 2, 2, i + 1)
      
          ax.set_title(&quot;%s trials, %s heads&quot; % (N, heads))
          # Add labels to both axes and hide labels on y-axis
          plt.xlabel(&quot;$P(H)$, Probability of Heads&quot;)
          plt.ylabel(&quot;Density&quot;)
          if i == 0:
              plt.ylim([0.0, 2.0])
              plt.setp(ax.get_yticklabels(), visible=False)
  
              # Create and plot a Beta distribution to represent the
              # posterior belief in fairness of the coin.
              y = stats.beta.pdf(x, 1 + heads, 1 + N - heads)
              plt.plot(x, y, label=&quot;observe %d tosses,\n %d heads&quot; % (N, heads))
              plt.fill_between(x, 0, y, color=&quot;#aaaadd&quot;, alpha=0.5)
              # Expand plot to cover full width/height and show it
              plt.tight_layout()
              plt.show()
  </code></pre>
  <p>I get the error in this line: <code>ax = plt.subplot(len(number_of_trials) / 2, 2, i + 1)</code>
  <code>ValueError: Number of rows must be a positive integer, not 3.0</code></p>
  <p>I tried to set <code>int(number_of_trials)</code> without success.</p>
  <p>Any ideas?</p>