Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 18th, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. matplotlib - single axis label for multi-panel plot?
  2. import matplotlib.pyplot as plt
  3. fig = plt.figure()
  4. ax1 = fig.add_subplot(2,1,1)
  5. ax1.scatter(1,1)
  6. ax2 = fig.add_subplot(2,1,2,sharex=ax1)
  7. ax2.scatter(1,1)
  8.        
  9. dummy = fig.add_subplot(1,1,1)
  10. dummy.set_visible(False)
  11. dummy.yaxis.set_label_text('y label')
  12. dummy.yaxis.label.set_visible(True)
  13.        
  14. import matplotlib.pyplot as plt
  15. fig = plt.figure()
  16. ax1 = fig.add_subplot(2,1,1)
  17. ax1.scatter(1,1)
  18. ax2 = fig.add_subplot(2,1,2,sharex=ax1)
  19. ax2.scatter(1,1)
  20.  
  21. ax = fig.add_axes( [0., 0., 1, 1] )
  22. ax.set_axis_off()
  23. ax.set_xlim(0, 1)
  24. ax.set_ylim(0, 1)
  25. ax.text(
  26.     .05, 0.5, "Y Label", rotation='vertical',
  27.     horizontalalignment='center', verticalalignment='center'
  28. )