Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not entirely sure what you're asking, but here's how I'd go about plotting something along those lines...</p> <p>The aspect ratio for your figure is controlled by the <code>figsize</code> kwarg to <code>plt.figure</code> (or <code>plt.subplots</code>, in this case).</p> <p>The rest you can do with judicious application of <code>annotate</code>.</p> <p>Here's an example:</p> <pre><code>import matplotlib.pyplot as plt import numpy as np # Generate the data data = (np.random.random((20, 2, 2, 1001)) - 0.5).cumsum(axis=-1) # Set up the figure (the figsize is what's going to control your aspect ratio) fig, axes = plt.subplots(nrows=20, ncols=2, sharex=True, figsize=(6, 10)) fig.subplots_adjust(wspace=0.1, hspace=0, bottom=0.05) # Turn off tick labels everywhere for ax in axes.flat: for axis in [ax.xaxis, ax.yaxis]: axis.set_ticklabels([]) # Plot the data color = {(0,0):'red', (0,1):'green', (1,0):'blue', (1,1):'magenta'} for (i,j), ax in np.ndenumerate(axes): for k in range(2): ax.plot(data[i,j,k,:], color=color[(j,k)]) # Add stacked titles (and text legends) titles = [['TITLE:', 'Red: Data X', 'Green: Data Y'], ['TITLE:', 'Blue: Data W', 'Magenta: Data Z']] for i, title in enumerate(titles): for text, ypos in zip(title, [35, 20, 5]): axes[0,i].annotate(text, xy=(0.05, 1.0), xytext=(0, ypos), va='bottom', xycoords='axes fraction', textcoords='offset points') # Add arrows on "super-Y" axes xpos, length = -0.1, 5 axes[12,0].annotate('', xy=(xpos, 0), xytext=(xpos, length), xycoords='axes fraction', textcoords='axes fraction', arrowprops=dict(arrowstyle='&lt;|-')) axes[12,0].annotate('{0} subplots'.format(length), xy=(xpos, length/2.0), xycoords='axes fraction', rotation=90, va='center', ha='right') # Add arrows on "super-X" axes ypos, length = -0.7, 1000 axes[-1,0].annotate('', xy=(0, ypos), xytext=(length, ypos), xycoords=('data', 'axes fraction'), textcoords=('data', 'axes fraction'), arrowprops=dict(arrowstyle='&lt;|-')) axes[-1,0].annotate('{0} data units'.format(length), xy=(length/2.0, ypos), xytext=(0, 5), xycoords=('data', 'axes fraction'), textcoords='offset points', ha='center', va='bottom') plt.show() </code></pre> <p><img src="https://i.stack.imgur.com/wTWjG.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload