title: Create a table of multiple mini barplots in Python
body: <p>I am trying to reproduce the table of barplots (created below in tableau) in Python.</p>
  <p><a href="https://i.stack.imgur.com/MB5Kh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MB5Kh.png" alt="The Plot that I am trying to recreate in Python" /></a></p>
  <p>I am struggling to figure out how to do it python (matplotlib, seaborn, pandas).</p>
  <p>Here is some example data that illustrates the problem:</p>
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  import numpy as np
  
  data = dict(
      correlation=np.random.normal(0, 0.5, 100),
      pvalue=np.random.normal(0.05, 0.02, 100),
      variable=np.tile(np.array([f&quot;variable{i}&quot; for i in range(10)]), 10),
      model=np.repeat(np.array([f&quot;model{i}&quot; for i in range(10)]), 10)
  )
  data = pd.DataFrame(data)
  data[&quot;significant&quot;] = data[&quot;pvalue&quot;] &lt; 0.05
  data[&quot;positive&quot;] = data[&quot;correlation&quot;] &gt; 0
  </code></pre>
  <p>My attempted plot for ONE MODEL (<code>&quot;model1&quot;</code>) illustrates roughly what I am looking for. As I said I am trying to reproduce the table of barplots (shown above), which would display the results for all of the models.</p>
  <pre class="lang-py prettyprint-override"><code>example_plot_data = data.loc[data.model == &quot;model1&quot;]
  example_plot_data.plot(
      kind=&quot;bar&quot;, x=&quot;variable&quot;, y=&quot;correlation&quot;,
      color=example_plot_data.positive.map({True: &quot;b&quot;, False: &quot;r&quot;}),
      rot=70,
  )
  plt.show()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Y0GED.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y0GED.png" alt="An example plot from Pandas for ONE MODEL" /></a></p>
  <p>Ideally these are the aesthetics I am looking for</p>
  <pre class="lang-py prettyprint-override"><code># Aesthetics for the plots:
  columns = data[&quot;model&quot;]
  rows = data[&quot;variable&quot;]
  bar_size = data[&quot;correlation&quot;]        # ideally centred on zero
  bar_color = data[&quot;correlation&quot;]       # ideally centred on zero (RdBu)
  bar_significance = data[&quot;significant&quot;]
  </code></pre>